We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I tried to override the level of color support using $FORCE_COLOR environment variable, but I got
$FORCE_COLOR
> cat test.mjs import { supportsColor } from 'chalk'; console.log("FORCE_COLOR:", process.env.FORCE_COLOR, "\tsupportsColor:", supportsColor); > for i in 0 1 2 3; env FORCE_COLOR=$i node test.mjs; end FORCE_COLOR: 0 supportsColor: false FORCE_COLOR: 1 supportsColor: { level: 3, hasBasic: true, has256: true, has16m: true } FORCE_COLOR: 2 supportsColor: { level: 3, hasBasic: true, has256: true, has16m: true } FORCE_COLOR: 3 supportsColor: { level: 3, hasBasic: true, has256: true, has16m: true }
Chalk version: 5.3.0 Node version: 20.10.0
Note that my terminal is Alacritty and it supports truecolor, so the default color support level should be 3 in my environment.
The text was updated successfully, but these errors were encountered:
Oh I see. If $COLORTERM=truecolor is set, even if $FORCE_COLOR is less than 3, supportsColor happens to be set to 3.
$COLORTERM=truecolor
supportsColor
> set --global --export COLORTERM truecolor > for i in 0 1 2 3; env FORCE_COLOR=$i node test.mjs; end FORCE_COLOR: 0 supportsColor: false FORCE_COLOR: 1 supportsColor: { level: 3, hasBasic: true, has256: true, has16m: true } FORCE_COLOR: 2 supportsColor: { level: 3, hasBasic: true, has256: true, has16m: true } FORCE_COLOR: 3 supportsColor: { level: 3, hasBasic: true, has256: true, has16m: true } > set --erase COLORTERM > for i in 0 1 2 3; env FORCE_COLOR=$i node test.mjs; end FORCE_COLOR: 0 supportsColor: false FORCE_COLOR: 1 supportsColor: { level: 1, hasBasic: true, has256: false, has16m: false } FORCE_COLOR: 2 supportsColor: { level: 2, hasBasic: true, has256: true, has16m: false } FORCE_COLOR: 3 supportsColor: { level: 3, hasBasic: true, has256: true, has16m: true }
Sorry, something went wrong.
No branches or pull requests
I tried to override the level of color support using
$FORCE_COLOR
environment variable, but I gotChalk version: 5.3.0
Node version: 20.10.0
Note that my terminal is Alacritty and it supports truecolor, so the default color support level should be 3 in my environment.
The text was updated successfully, but these errors were encountered: