Skip to content

Commit

Permalink
detect colors on not windows
Browse files Browse the repository at this point in the history
  • Loading branch information
theofidry committed Dec 8, 2023
1 parent d9648a1 commit 4b4d8cd
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Output/StreamOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit 4b4d8cd

Please sign in to comment.