File tree 1 file changed +14
-2
lines changed
src/Symfony/Component/Console/Output
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -106,10 +106,22 @@ protected function hasColorSupport()
106
106
return true ;
107
107
}
108
108
109
- return 'Hyper ' === getenv ('TERM_PROGRAM ' )
109
+ if ('Hyper ' === getenv ('TERM_PROGRAM ' )
110
+ || false !== getenv ('COLORTERM ' )
110
111
|| false !== getenv ('ANSICON ' )
111
112
|| 'ON ' === getenv ('ConEmuANSI ' )
112
- || str_starts_with ((string ) getenv ('TERM ' ), 'xterm ' );
113
+ ) {
114
+ return true ;
115
+ }
116
+
117
+ $ term = (string ) getenv ('TERM ' );
118
+
119
+ if ('dumb ' === $ term ) {
120
+ return false ;
121
+ }
122
+
123
+ // See https://github.com/chalk/supports-color/blob/d4f413efaf8da045c5ab440ed418ef02dbb28bf1/index.js#L157
124
+ return 1 === @preg_match ('/^((screen|xterm|vt100|vt220|putty|rxvt|ansi|cygwin|linux).*)|(.*-256(color)?(-bce)?)$/ ' , $ term );
113
125
}
114
126
115
127
/**
You can’t perform that action at this time.
0 commit comments