public function supportsColors()

in src/Terminal.hack [28:68]


  public function supportsColors(): bool {
    $colors = \getenv('CLICOLORS');
    if (
      $colors === '1' ||
      $colors === 'yes' ||
      $colors === 'true' ||
      $colors === 'on'
    ) {
      return true;
    }
    if (
      $colors === '0' ||
      $colors === 'no' ||
      $colors === 'false' ||
      $colors === 'off'
    ) {
      return false;
    }

    if (\getenv('TRAVIS') === 'true') {
      return true;
    }

    if (\getenv('CIRCLECI') === 'true') {
      return true;
    }

    if (\getenv('TERM') === 'xterm') {
      return true;
    }

    if (\getenv('TERM_PROGRAM') === 'Hyper') {
      return true;
    }

    if ($this->isInteractive()) {
      return Str\contains((string)\getenv('TERM'), 'color');
    }

    return false;
  }