utils.ievv_colorize — Colorized output for terminal stdout/stderr

ievv_opensource.utils.ievv_colorize.COLOR_RED = 'red'

Red color constant for ievv_colorize().

ievv_opensource.utils.ievv_colorize.COLOR_BLUE = 'blue'

Blue color constant for ievv_colorize().

ievv_opensource.utils.ievv_colorize.COLOR_YELLOW = 'yellow'

Yellow color constant for ievv_colorize().

ievv_opensource.utils.ievv_colorize.COLOR_GREY = 'grey'

Grey color constant for ievv_colorize().

ievv_opensource.utils.ievv_colorize.COLOR_GREEN = 'green'

Green color constant for ievv_colorize().

ievv_opensource.utils.ievv_colorize.colorize(text, color, bold=False)[source]

Colorize a string for stdout/stderr.

Colors are only applied if IEVV_COLORIZE_USE_COLORS is True or not defined (so it defaults to True).

Examples

Print blue text:

from ievv_opensource.utils import ievv_colorize

print(ievv_colorize('Test', color=ievv_colorize.COLOR_BLUE))

Print bold red text:

print(ievv_colorize('Test', color=ievv_colorize.COLOR_RED, bold=True))
Parameters: