Skip to main content

Your own expressive painter who colors text in your terminal.

Project description

Painter is an ANSI coloring library heavily based on the awesome chalk library for Node.js along with all its dependences. 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
print(paint.blue.on_red.bold.underline('and far more complex combos too'))
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(':)'))

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.2.tar.gz (4.0 kB view hashes)

Uploaded Source

Supported by

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