diff --git a/environment.js b/environment.js index 0afdd7f..2ee2fe4 100644 --- a/environment.js +++ b/environment.js @@ -132,10 +132,21 @@ const forceColor = isNode && f.isOneOf(process.env.FORCE_COLOR, ['true', '1', '2']) /* c8 ignore start */ -export const supportsColor = !hasParam('--no-colors') && - (!isNode || process.stdout.isTTY || forceColor) && ( - !isNode || hasParam('--color') || forceColor || +/** + * Color is enabled by default if the terminal supports it. + * + * Explicitly enable color using `--color` parameter + * Disable color using `--no-color` parameter or using `NO_COLOR=1` environment variable. + * `FORCE_COLOR=1` enables color and takes precedence over all. + */ +export const supportsColor = forceColor || ( + !hasParam('--no-colors') && // @todo deprecate --no-colors + !hasConf('no-color') && + (!isNode || process.stdout.isTTY) && ( + !isNode || + hasParam('--color') || getVariable('COLORTERM') !== null || (getVariable('TERM') || '').includes('color') + ) ) /* c8 ignore stop */