function supportsColor()

in scripts/internal/supports-color.js [61:131]


function supportsColor (streamIsTTY) {
  if (forceColor === false) {
    return false
  }

  if (hasFlag('--color=16m') ||
    hasFlag('--color=full') ||
    hasFlag('--color=truecolor')) {
    return true
  }

  if (hasFlag('--color=256')) {
    return true
  }

  if (!streamIsTTY && forceColor === undefined) {
    return false
  }

  const min = forceColor || false

  if (env.TERM === 'dumb') {
    return min
  }

  if (process.platform === 'win32') {
    return true
  }

  if ('CI' in env) {
    if (
      ['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS'].some(sign => sign in env) ||
        env.CI_NAME === 'codeship'
    ) {
      return true
    }

    return min
  }

  if ('TEAMCITY_VERSION' in env) {
    return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION)
  }

  if (env.COLORTERM === 'truecolor') {
    return true
  }

  if ('TERM_PROGRAM' in env) {
    switch (env.TERM_PROGRAM) {
      case 'iTerm.app':
      case 'Apple_Terminal':
        return true
      // No default
    }
  }

  if (/-256(color)?$/i.test(env.TERM)) {
    return true
  }

  if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
    return true
  }

  if ('COLORTERM' in env) {
    return true
  }

  return min
}