Fix FORCE_COLOR override when COLORTERM is set
When COLORTERM=truecolor is set, FORCE_COLOR=1 and FORCE_COLOR=2 were both returning level 3 instead of respecting the specified level. This happened because terminal detection (checking for COLORTERM) was running after FORCE_COLOR was parsed, overriding the explicit user preference. The fix adds an early return when FORCE_COLOR is explicitly set, preventing any terminal detection logic from overriding the user's choice. This ensures FORCE_COLOR takes priority over automatic terminal capability detection. Fixes #624
This commit is contained in:
parent
aa06bb5ac3
commit
dab86650a7
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
|
|
@ -81,6 +81,12 @@ function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
|
|||
}
|
||||
}
|
||||
|
||||
// If FORCE_COLOR is explicitly set, return it immediately
|
||||
// to prevent terminal detection from overriding it
|
||||
if (forceColor !== undefined) {
|
||||
return forceColor;
|
||||
}
|
||||
|
||||
// Check for Azure DevOps pipelines.
|
||||
// Has to be above the `!streamIsTTY` check.
|
||||
if ('TF_BUILD' in env && 'AGENT_NAME' in env) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue