Usage

colorin uses ANSI escape sequences internally to format, color and apply other options to the output displayed in text terminals.

Typical usage involves creating an instance of colorin.cli.Display class, and tell it what to do with your text. For example, let's suppose you want to print "Hello world!" in green and "Bye world!" in red:

#! /usr/bin/env python

from colorin.cli import Display

screen = Display()
screen.color("Hello world!", "Green")
screen.color("Bye world!", "Red")


Foreground and background colors

In the code example above, we just specified the foreground color for the text. You can use the same method (Display.color()) to add a background color. The following code will print a white text on a yellow background:

#! /usr/bin/env python

from colorin.cli import Display

screen = Display()
screen.color("Warning!", "White", "Yellow")


The set of colors available for both, text foreground and background, is limited to the following list: Black, Red, Green, Yellow, Blue, Magenta, Cyan and White.

...

...