From dab86650a7b64cbbdd59af36d75e319af34d1211 Mon Sep 17 00:00:00 2001 From: Varun Chawla Date: Fri, 13 Feb 2026 00:50:03 -0800 Subject: [PATCH] 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 --- source/vendor/supports-color/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/vendor/supports-color/index.js b/source/vendor/supports-color/index.js index 265d7f8..91b9c63 100644 --- a/source/vendor/supports-color/index.js +++ b/source/vendor/supports-color/index.js @@ -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) {