Skip to main content

ANSI colors for Python

A simple module to add ANSI colors and decorations to your strings.

Example Usage

You can choose one of the 8 basic ANSI colors: black, red, green, yellow, blue, magenta, cyan, white.

from tmcolors import red, green, blue
print red('This is red')
print green('This is green')
print blue('This is blue')

Optionally you can specify a background color.

print red('red on blue', bg='blue')
print green('green on black', bg='black')

You can additionally specify one of the supported styles: bold, faint, italic, underline, blink, blink2, negative, concealed, crossed. Not all styles are supported by all terminals.

from tmcolors import bold, underline
print bold('This is bold')
print underline('underline red on blue', fg='red', bg='blue')
print green('bold green on black', bg='black', style='bold')

You can also use more than one styles at once.

print red('This is very important', style='bold+underline')

xterm-256 colors are supported as well, to use them give an integer instead of a color name.

from tmcolors import colorize
for i in range(256):
    print colorize('Color #%d' % i, fg=i)

License

tmcolors is licensed under the ISC license.

Metadata

Release files for tmcolors 0.1.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 tmcolors 0.1.1
File Size Uploaded
tmcolors-0.1.1.tar.gz 3.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tmcolors 0.1.1
File Interpreter ABI Platform
tmcolors-0.1.1-py2-none-any.whl Python 2 none any Details

Total release size: 7.5 kB

Release files / tmcolors-0.1.1.tar.gz

Download URL tmcolors-0.1.1.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f6747a5951b757aee019fef8d465d30caee7f23651d926614de6a56e4bdf0cd0
BLAKE2b-256 checksum
How to use checksums
16cce181ecd0a6f78e72cb9f8e2950253a893a3cbc6ab202fea8ae6620d35354
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / tmcolors-0.1.1-py2-none-any.whl

Download URL tmcolors-0.1.1-py2-none-any.whl
Size 4.5 kB
Tags Python 2
SHA-256 checksum
How to use checksums
1009b554671de075b0ca451c2f2543e76c72f7bb77e2e69dc424779eb1253270
BLAKE2b-256 checksum
How to use checksums
a6fc4c4e36409095b022fff00c071738a8ab45f8bbf901de33e1210eaffe140b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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