Function console::colors_enabled

source ·
pub fn colors_enabled() -> bool
Expand description

Returns true if colors should be enabled for stdout.

This honors the clicolors spec.

  • CLICOLOR != 0: ANSI colors are supported and should be used when the program isn’t piped.
  • CLICOLOR == 0: Don’t output ANSI color escape codes.
  • CLICOLOR_FORCE != 0: ANSI colors should be enabled no matter what.