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_COLORSisTrueor not defined (so it defaults toTrue).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: - text – The text (string) to colorize.
- color –
The color to use. Should be one of:
COLOR_REDCOLOR_BLUECOLOR_YELLOWCOLOR_GREYCOLOR_GREENNone(no color)
- bold – Set this to
Trueto use bold font.