Skip to content

_term

Terminal styling for the console scripts.

Colour and symbols where they help, plain text everywhere else. Colour is used only when standard output is a terminal and NO_COLOR is unset (https://no-color.org). Symbols fall back to ASCII when the terminal's encoding cannot show them, so a log file or a CI console never sees garbage.

arrow(stream=sys.stdout)

Return a right arrow, or ->.

colour_enabled(stream=sys.stdout)

Return whether to emit ANSI colour on this stream.

style(text, *codes, stream=sys.stdout)

Wrap text in the named styles when colour is enabled.

symbol(unicode, ascii_fallback, stream=sys.stdout)

Return unicode when the stream can encode it, else the fallback.

tick(stream=sys.stdout)

Return a green check mark, or +.