Skip to main content

stderr_color

Function stderr_color 

Source
pub fn stderr_color() -> bool
Expand description

#1666: whether diagnostics on stderr are coloured: only when stderr is a terminal and NO_COLOR is unset or empty (https://no-color.org). Colour piped into a file or a CI log is noise, and ariadne colours per character, so it multiplied the output’s size by about twenty.

#1777: FORCE_COLOR (https://force-color.org) or CLICOLOR_FORCE (https://bixense.com/clicolors/), set to anything but the empty string or 0, turns colour on without a terminal, for less -R or a CI log that renders ANSI. 0 means “don’t force”, not “force off”: NO_COLOR is the off switch, and it wins over both. That is clap’s order for NO_COLOR and CLICOLOR_FORCE; clap doesn’t read FORCE_COLOR, so only CLICOLOR_FORCE also colours clap’s own help and errors.