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

Honour NO_COLOR environment variable alongside CLICOLOR #197

Open
mkaput opened this issue Jan 18, 2024 · 0 comments · May be fixed by #198
Open

Honour NO_COLOR environment variable alongside CLICOLOR #197

mkaput opened this issue Jan 18, 2024 · 0 comments · May be fixed by #198

Comments

@mkaput
Copy link

mkaput commented Jan 18, 2024

While this crate follows https://bixense.com/clicolors/, several crates in the ecosystem (for example tracing) follow another convention of forcing tools not to print coloured output: https://no-color.org/

I wonder if it wouldn't be feasible to support both conventions simultaneously in this crate. The unknown question is which convention should be prioritized. Personally, I think it doesn't matter and would probably check NO_COLOR after CLICOLOR.

Relevant code, as far as I see, is only this chunk:

console/src/utils.rs

Lines 19 to 23 in de2f15a

fn default_colors_enabled(out: &Term) -> bool {
(out.features().colors_supported()
&& &env::var("CLICOLOR").unwrap_or_else(|_| "1".into()) != "0")
|| &env::var("CLICOLOR_FORCE").unwrap_or_else(|_| "0".into()) != "0"
}

darimari21 added a commit to darimari21/console that referenced this issue Jan 18, 2024
darimari21 added a commit to darimari21/console that referenced this issue Jan 18, 2024
@darimari21 darimari21 linked a pull request Jan 21, 2024 that will close this issue
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 a pull request may close this issue.

1 participant