fix: respect FORCE_COLOR env var over auto-detection
The FORCE_COLOR environment variable was being overridden by other environment variables like COLORTERM, TERM, etc. This fix ensures that when FORCE_COLOR is explicitly set, its value takes precedence over automatic color support detection. Fixes #624
This commit is contained in:
parent
aa06bb5ac3
commit
38068f6296
1 changed files with 6 additions and 0 deletions
6
source/vendor/supports-color/index.js
vendored
6
source/vendor/supports-color/index.js
vendored
|
|
@ -93,6 +93,12 @@ function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
|
||||||
|
|
||||||
const min = forceColor || 0;
|
const min = forceColor || 0;
|
||||||
|
|
||||||
|
// If forceColor was explicitly set (via FORCE_COLOR env or --color flag),
|
||||||
|
// respect it and don't override with auto-detection
|
||||||
|
if (forceColor !== undefined) {
|
||||||
|
return min;
|
||||||
|
}
|
||||||
|
|
||||||
if (env.TERM === 'dumb') {
|
if (env.TERM === 'dumb') {
|
||||||
return min;
|
return min;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue