console-rs / console-rs/console
Honour `NO_COLOR` environment variable alongside `CLICOLOR`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.2k
- Forks
- 144
- Avg merge
- 8h 24m
- Merged PRs (30d)
- 4
Description
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:
https://github.com/console-rs/console/blob/de2f15a31a8fef0b0e65ef4bdf92cd03c3061dac/src/utils.rs#L19-L23
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the color-detection code in src/utils.rs at the referenced lines and compare how CLICOLOR is currently handled. Decide and document which convention takes precedence when NO_COLOR and CLICOLOR are both present, then verify that both environment-variable conventions control colored output as intended.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 39/100