Function console::colors_enabled [] [src]

pub fn colors_enabled() -> bool

Returns true if colors should be enabled.

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.

This internally uses clicolors-control.