resolveIsColorSupported function

bool resolveIsColorSupported({
  1. EnvLookup? readEnv,
  2. List<String> argv = const [],
  3. String? platform,
  4. bool? stdoutIsTTY,
})

picocolors' module-level isColorSupported expression: color is enabled unless NO_COLOR/--no-color disables it, and one of FORCE_COLOR, --color, win32, an interactive non-dumb terminal, or CI enables it.

Node reads process.argv; Dart has no global argv, so argv defaults to an empty list (the dotweave CLI never passes --color/--no-color).

Implementation

bool resolveIsColorSupported({
  EnvLookup? readEnv,
  List<String> argv = const [],
  String? platform,
  bool? stdoutIsTTY,
}) {
  final environment = readEnv ?? lookupPlatformEnv;
  final platformName = platform ?? _processPlatform();
  final isTTY = stdoutIsTTY ?? stdout.hasTerminal;

  return !(_isTruthyEnvValue(environment('NO_COLOR')) ||
          argv.contains('--no-color')) &&
      (_isTruthyEnvValue(environment('FORCE_COLOR')) ||
          argv.contains('--color') ||
          platformName == 'win32' ||
          (isTTY && environment('TERM') != 'dumb') ||
          _isTruthyEnvValue(environment('CI')));
}