Fetching contributors…
Cannot retrieve contributors at this time
35 lines (18 sloc) 768 Bytes

Getting started with colors

To highlight using colors:


This will emit ansi escapes into the string: one when starting a color, another to reset the color back to the default:

>>> from ansicolor import green

>>> green("green")

If I want to be able to pass a color as an argument I can also use the colorize function:


I can also apply color on a portion of a string: