Color theme¶
Color themes.
The theme is available in the cli2.t namespace.
Example:
import cli2
print(f'{cli2.theme.green}OK{cli2.theme.reset}')
# with a mode, such as bold, dim, italic, underline and strike:
print(f'{cli2.theme.green.bold}OK{cli2.theme.reset}')
# all is also callable appending the reset automatically
print(cli2.theme.green('OK'))
print(cli2.theme.green.bold('OK'))
We also have shortcuts, cli2.theme
is cli2.t
, each color can be
referred to by first letter in lowercase, except for black and gray which are
refered to by their first letter in uppercase. Modes can be referred to by
first letter in lowercase too, and reset is rs:
# shortcuts
print(f'{cli2.t.g.b}OK{cli2.t.rs}')
# shorter with callable
print(cli2.t.g.b('OK'))
Run cli2-theme
for the list of colors by theme.

Note
The old colors system, in cli2.c
, is preserved for backward
compatibility.