Skip to main content

Your own expressive painter who colors text in your terminal.

Project description

Build Status Coverage Status License Latest Version Downloads

Painter Logo

Painter is an ANSI coloring library based on the excellent chalk and colors.js libraries for Node.js. However, painter attempts to provide an even more expressive API which reads like English.

Painter is fully tested with 100% coverage and also completely Flake8 compilant too!

Quick Start

Install Painter in your virtualenv as follows:

pip install painter

And now, go ahead and use it to output colors to your terminal:

from __future__ import print_function

from painter import paint

# Simple printing of colors
print('Welcome to Painter!', paint.red('I can paint things red'),
      paint.blue('and blue'))

# Chaining colors and styles
print(paint.blue.on_red.bold.underline('and far more complex combos too'))
print()

# Using color patterns
print(paint.rainbow('Awww look, a pretty rainbow :)'))
print(paint.zebra('and a scary looking zebra!'))
print()

# Nested painting
print(paint.on_red('I can also use a background color across',
                   paint.blue('multiple'),
                   paint.yellow('foreground colors')))

# Custom separator
print(paint('and', 'allow', 'you to use', paint.red('custom separators'),
      sep='-'))
print()

# Creating themes
cool_theme = paint.green.on_red.underline.bold
print('Creating', cool_theme('your own theme'), 'is easy')

# Easily disable painting of colors
paint.enabled = False
print('and I allow you to easily', paint.red('disable'), paint.blue('me'))
print()

paint.enabled = True
print('Hope you have a', paint.blue('lovely day!'), paint.green(':)'))

The output of this script looks something like this:

Painter Demo

Documentation

For full details on using Painter, please check out the Painter GitHub Page.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

painter-0.3.tar.gz (5.6 kB view details)

Uploaded Source

File details

Details for the file painter-0.3.tar.gz.

File metadata

  • Download URL: painter-0.3.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for painter-0.3.tar.gz
Algorithm Hash digest
SHA256 111f135ce458a23c4388667e6146e148a7ca07d572b389dfec866c964807b762
MD5 d1e81fb60556f59fc5bc6ffdfe9b4e7d
BLAKE2b-256 fa28f8d0f7af9c0c1bc075ae668a28efe1b5c96b78e60c84698f5074b477b066

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page