Skip to main content

Painter

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 compliant 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.

Metadata

Release files for painter 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for painter 0.3.1
File Size Uploaded
painter-0.3.1.tar.gz 5.7 kB Details

Release files / painter-0.3.1.tar.gz

Download URL painter-0.3.1.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3373463d584ba9bbbb23d570c37893e7930b93704fe1149df88e9d2ef906fc88
BLAKE2b-256 checksum
How to use checksums
82a16b98ddf98374c29f930eae8cbdcde25480e1b83d21c32a3c4e61b0df019c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.3.1 This release

1 release file

0.3

1 release file

0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page