You are here

public function Console::hasColorSupport in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/sebastian/environment/src/Console.php \SebastianBergmann\Environment\Console::hasColorSupport()

Returns true if STDOUT supports colorization.

This code has been copied and adapted from Symfony\Component\Console\Output\OutputStream.

Return value

bool

File

vendor/sebastian/environment/src/Console.php, line 29

Class

Console

Namespace

SebastianBergmann\Environment

Code

public function hasColorSupport() {
  if (DIRECTORY_SEPARATOR == '\\') {
    return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI');
  }
  if (!defined('STDOUT')) {
    return false;
  }
  return $this
    ->isInteractive(STDOUT);
}