ANSI escape codes in Python
ansi(bold, underlined, inverse, foreground, background) => str
By default ansi()
does not actually change anything.
bold
, underlined
, and inverse
can be set to None
to signify no change, True
to enable them, or False
to disable them.
foreground
and background
can be set to an int
in colors
or brightcolors
, a color
object for true color, or None
for no change.
reset()
will reset the terminal. It is equivalent to setting bold
, underlined
, and inverse
to False
, and setting foreground
and background
to colors.default
.
bold(string)
underlined(string)
inverse(string)
foreground(color, string)
background(color, string)
These functions wrap a str
and set the respective property.