envNoColor method

bool envNoColor()

EnvNoColor returns true if the terminal should not emit colors based on the environment. NO_COLOR wins; CLICOLOR=="0" requires CLICOLOR_FORCE to flip back on. Piped stdout also forces no-color.

Implementation

bool envNoColor() {
  if (_b.env.containsKey('NO_COLOR')) return true;
  if (_b.env['CLICOLOR'] != null || isColorForced) return false;
  return !hasOutputTerminal;
}