Skip to main content

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.

Download files

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

Source Distribution

tmcolors-0.1.0.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tmcolors-0.1.0-py2-none-any.whl (3.1 kB view details)

Uploaded Python 2

File details

Details for the file tmcolors-0.1.0.tar.gz.

File metadata

  • Download URL: tmcolors-0.1.0.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for tmcolors-0.1.0.tar.gz
Algorithm Hash digest
SHA256 49cb19e63e1e594204a2d493aee21a200c2a15163b7d574003661002034b60f3
MD5 4afca11aad859940c143c337cb883c5c
BLAKE2b-256 a3f10570ca36d3814b7294289278f14943b7b1380e5f7b5c45901673689ff971

See more details on using hashes here.

File details

Details for the file tmcolors-0.1.0-py2-none-any.whl.

File metadata

File hashes

Hashes for tmcolors-0.1.0-py2-none-any.whl
Algorithm Hash digest
SHA256 f345dd8ff92da89897c1138d71be152f862da09ef686ea5b3ea57d5a07d922fd
MD5 67fa950681733d70c248b171c1bbc559
BLAKE2b-256 355cf11c45423b6e156940a70697b9421d5be656f44947ab641851315095d69f

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.1

2 files

This release

0.1.0 This release

2 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