console-rs / console

A rust console and terminal abstraction
MIT License
963 stars 114 forks source link

Honour `NO_COLOR` environment variable alongside `CLICOLOR` #197

Open mkaput opened 10 months ago

mkaput commented 10 months ago

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