From 4b4d8cd118484aa604ec519062113dd87abde18c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= Date: Fri, 8 Dec 2023 14:32:57 +0100 Subject: [PATCH] detect colors on not windows --- Output/StreamOutput.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Output/StreamOutput.php b/Output/StreamOutput.php index f67fe5904..f057f0e51 100644 --- a/Output/StreamOutput.php +++ b/Output/StreamOutput.php @@ -95,15 +95,17 @@ protected function hasColorSupport() return false; } - if (\DIRECTORY_SEPARATOR === '\\') { - return (\function_exists('sapi_windows_vt100_support') - && @sapi_windows_vt100_support($this->stream)) - || false !== getenv('ANSICON') - || 'ON' === getenv('ConEmuANSI') - || str_starts_with((string) getenv('TERM'), 'xterm'); + if (\DIRECTORY_SEPARATOR === '\\' + && \function_exists('sapi_windows_vt100_support') + && @sapi_windows_vt100_support($this->stream) + ) { + return true; } return 'Hyper' === getenv('TERM_PROGRAM') + || false !== getenv('ANSICON') + || 'ON' === getenv('ConEmuANSI') + || str_starts_with((string) getenv('TERM'), 'xterm') || stream_isatty($this->stream); } }