retargetColors static method
void
retargetColors()
Re-evaluates useColors for the stream the human output will use.
--json moves that output to stderr, so a run whose stdout is piped to a
parser while stderr is still a terminal should keep its colours — and the
reverse, a piped stderr should lose them.
Implementation
static void retargetColors() {
if (Platform.environment.containsKey('NO_COLOR')) return;
useColors =
reserveStdout ? stderr.supportsAnsiEscapes : stdout.supportsAnsiEscapes;
}