rich#

set_color_when(when)#

Set when color should be applied. Options are:

  • True or ‘always’: always print color

  • False or ‘never’: never print color

  • None or ‘auto’: only print color if sys.stderr is a tty.

colorize(message: str, *, color: bool | None = None) str#
Render a Rich-markup string to:
  • ANSI-colored text if color=True

  • Plain text if color=False

The returned value is a string suitable for logging or file output.

clen(string)#

Return the length of a string, excluding ansi color sequences.

cstrip(string)#

Strip ansi color sequences from string

cextra(string)#

Length of extra color characters in a string

bold(arg: str) str#
code(arg: str) str#