Skip to main content

should_color

Function should_color 

Source
pub fn should_color(choice: ColorChoice, is_tty: bool) -> bool
Expand description

Determine whether ANSI colors should be emitted given the user’s choice and whether stdout is currently a TTY.

This is a pure function that can be tested without side-effects.

choiceis_ttyresult
Alwaysanytrue
Neveranyfalse
Autotruetrue
Autofalsefalse