Skip to main content

Print text using color formatting

Project description


This package provides the various tcprint_XXX routines which
can be used to print the text using color formatting.

Internally, ANSI color codes are used to format the text.

Typical usage often looks like this::

#!/usr/bin/env python

from tcprint import *

tcprint_red('Text in red')
tcprint_B_red('Text in bold red')

tcprint_red_on_green('Red text against a green background')
tcprint_B_red_on_green('Bold Red text against a green background')

tcprint_red_on_B_yellow('Red text against a bold yellow background')
tcprint_B_red_on_B_magenta('Bold red text against a bold magenta background')

Available Colors

* black
* red
* green
* yellow
* blue
* magenta
* cyan
* white

For Bold colors use B_ prefix as shown in the example

Thanks also to

This package was inspired by termcolor package by Konstantin Lepa

It's really a very useful package. I personally didn't want to specify the
colors towards the end of the line via arguments. Having just the text within
the double quotes [tcprint_red("text to be printed")] seems more readable for me.

Will add the other text attributes, like underline/blink, in the next release

Project details

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page