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(colors): only print colors if NO_COLOR is non-empty string #610

Merged
merged 1 commit into from
Jan 19, 2025

Conversation

pcrockett
Copy link
Collaborator

@pcrockett pcrockett commented Jan 18, 2025

from https://no-color.org/:

Command-line software which adds ANSI color to its output by default
should check for a NO_COLOR environment variable that, when present
and not an empty string (regardless of its value), prevents the
addition of ANSI color.

(emphasis mine)

if NO_COLOR is an empty string, color should still be printed.

./my-cli  # print color
NO_COLOR=1 ./my-cli  # don't print color
NO_COLOR=0 ./my-cli  # don't print color
NO_COLOR=whatever ./my-cli  # don't print color

NO_COLOR= ./my-cli  # YES PRINT COLOR

from <https://no-color.org/>:

> Command-line software which adds ANSI color to its output by default
> should check for a NO_COLOR environment variable that, when present
> and **not an empty string** (regardless of its value), prevents the
> addition of ANSI color.

(emphasis mine)

if NO_COLOR is an empty string, color should still be printed.
@pcrockett pcrockett requested a review from DannyBen January 18, 2025 19:44
@DannyBen
Copy link
Owner

Thanks. Merging.

@DannyBen DannyBen merged commit 29c5e60 into master Jan 19, 2025
9 checks passed
@DannyBen DannyBen deleted the fix/no-color-spec branch January 19, 2025 07:07
@DannyBen DannyBen added this to the 1.2.9 milestone Jan 21, 2025
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.

2 participants