You are here

protected function StreamOutput::hasColorSupport in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/console/Output/StreamOutput.php \Symfony\Component\Console\Output\StreamOutput::hasColorSupport()

Returns true if the stream supports colorization.

Colorization is disabled if not supported by the stream:

  • Windows without Ansicon, ConEmu or Mintty
  • non tty consoles

Return value

bool true if the stream supports colorization, false otherwise

1 call to StreamOutput::hasColorSupport()
StreamOutput::__construct in vendor/symfony/console/Output/StreamOutput.php
Constructor.

File

vendor/symfony/console/Output/StreamOutput.php, line 91

Class

StreamOutput
StreamOutput writes the output to a given stream.

Namespace

Symfony\Component\Console\Output

Code

protected function hasColorSupport() {
  if (DIRECTORY_SEPARATOR === '\\') {
    return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') || 'xterm' === getenv('TERM');
  }
  return function_exists('posix_isatty') && @posix_isatty($this->stream);
}