Skip to content
New issue

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

fix(ioconfig): disable color when TERM is dumb #163

Merged
merged 2 commits into from Jan 30, 2024
Merged

Conversation

ee7
Copy link
Contributor

@ee7 ee7 commented Jan 26, 2024

Issue

#162

Description

Chalk output previously contained color when the TERM environment variable had the value dumb. Disable color for that situation.

Chalk already correctly disabled color when:

  • The user passes --no-color (see also https://no-color.org/). For example:

    chalk version --no-color

  • The NO_COLOR environment variable is set. For example:

    NO_COLOR=1 chalk version

  • stdout is not a tty. For example:

    chalk version > /tmp/version.txt

Fixes: #162

Testing

Run e.g. TERM=dumb chalk version and observe the lack of color.

We don't currently have a test for TERM=dumb or NO_COLOR=1.

Chalk output previously contained color when the `TERM` environment
variable had the value `dumb`. Disable color for that situation.

Chalk already correctly disabled color when:

- The user passes `--no-color` [1], For example:

     `chalk version --no-color`

- The `NO_COLOR` environment variable is set. For example:

     `NO_COLOR=1 chalk version`

- stdout is not a tty. For example:

     `chalk version > /tmp/version.txt`

Closes: #162

[1] See also https://no-color.org/
@ee7 ee7 marked this pull request as ready for review January 29, 2024 15:05
@ee7 ee7 requested a review from viega as a code owner January 29, 2024 15:05
@ee7 ee7 merged commit b9bcde8 into main Jan 30, 2024
2 checks passed
@ee7 ee7 deleted the ee7/disable-color-TERM-dumb branch January 30, 2024 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Chalk should disable color when TERM env var has the value dumb
2 participants