win10下支持带颜色输出

This commit is contained in:
yunwuxin
2016-07-12 14:27:16 +08:00
parent 7281e76aff
commit 4742993737
5 changed files with 27 additions and 18 deletions

View File

@@ -32,6 +32,8 @@ class Stream
/**
* 构造方法
* @param $stream
* @param Formatter $formatter
*/
public function __construct($stream, Formatter $formatter = null)
{
@@ -180,8 +182,12 @@ class Stream
*/
protected function hasColorSupport()
{
if (DIRECTORY_SEPARATOR == '\\') {
return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI');
if (DIRECTORY_SEPARATOR === '\\') {
return
0 >= version_compare('10.0.10586', PHP_WINDOWS_VERSION_MAJOR . '.' . PHP_WINDOWS_VERSION_MINOR . '.' . PHP_WINDOWS_VERSION_BUILD)
|| false !== getenv('ANSICON')
|| 'ON' === getenv('ConEmuANSI')
|| 'xterm' === getenv('TERM');
}
return function_exists('posix_isatty') && @posix_isatty($this->stream);