tartley / colorama

Simple cross-platform colored terminal text in Python
BSD 3-Clause "New" or "Revised" License
3.56k stars 252 forks source link

Suggestion: supporting NO_COLOR environment variable #268

Open Ptival opened 4 years ago

Ptival commented 4 years ago

While color is great when you want it, it can be annoying when you don't.

https://no-color.org/

This manifesto suggests supporting a NO_COLOR environment variable that disables all color codes when set.

I think it'd be neat to officially support it.

mylesbartlett72 commented 3 years ago

This could be as simple as an option for colorama to "do nothing" and let scripts use os.getenv, although I don't see why it would be too hard for colorama to add in support.

tartley commented 3 years ago

There is a languishing PR, which I aim to merge imminently... https://github.com/tartley/colorama/pull/230

thetasine commented 2 years ago

I implemented this in 5 seconds under Windows:

if os.getenv('NO_COLOR'):
        colorama.init(strip=True, convert=False)       
nocnokneo commented 2 months ago

Similarly for FORCE_COLOR and/or CLICOLOR_FORCE