Skip to main content

ANSI colors for Python

Project description

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.

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

tmcolors-0.1.1.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

tmcolors-0.1.1-py2-none-any.whl (4.5 kB view details)

Uploaded Python 2

File details

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

File metadata

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

File hashes

Hashes for tmcolors-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f6747a5951b757aee019fef8d465d30caee7f23651d926614de6a56e4bdf0cd0
MD5 01eba6550bf32b1cf6fcc5de10aea97b
BLAKE2b-256 16cce181ecd0a6f78e72cb9f8e2950253a893a3cbc6ab202fea8ae6620d35354

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tmcolors-0.1.1-py2-none-any.whl
Algorithm Hash digest
SHA256 1009b554671de075b0ca451c2f2543e76c72f7bb77e2e69dc424779eb1253270
MD5 29cfe797896ed579456dd62c31fa5418
BLAKE2b-256 a6fc4c4e36409095b022fff00c071738a8ab45f8bbf901de33e1210eaffe140b

See more details on using hashes here.

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