should_colorize#

scikitplot.cleanprompt.should_colorize(stream=None, color=None)[source]#

Decide whether to emit terminal colour.

Parameters:
streamfile-like, optional

Destination. Defaults to sys.stdout.

colorbool, optional

Explicit override. True or False decides immediately.

Returns:
bool

Whether colour should be emitted.

Parameters:
  • stream (Any | None)

  • color (bool | None)

Return type:

bool

Notes

Developer notes. NO_COLOR is honoured whenever it is set to any value, per the convention at <https://no-color.org>. A stream without isatty — a pipe, a file, a captured buffer in a test — is treated as not a terminal.

Examples

>>> should_colorize(color=False)
False