Description
Have you checked the issues for a similar suggestions?
Yes, initially rejected at #343 but further discussed more favourably at pypa/pip#10909 (comment).
How would you improve Rich?
If the FORCE_COLOR
environment variable is set -- to any value -- then enable the use of colour.
(I'm not specifically requesting it here, but could be worth considering: If the NO_COLOR
environment variable is set -- to any value -- then disable the use of colour. NO_COLOR
should override FORCE_COLOR
. Re: https://no-color.org/)
What problem does it solve for you?
What problem do you have that this feature would solve? I may be able to suggest an existing way of solving it.
pip 22 now uses Rich for installation progress bars and some error handling, which gives us pretty colours! And more of pip's interface is being switched over to use Rich for improved usability.
Colour can help diagnose problems, and a common place for pip and the need to diagnose problems is on a CI, where you get a big wall of text.
However, because GitHub Actions isn't a tty, output of tools which autodetect the terminal output is usually monochrome. That's why many tools and CI setups use the FORCE_COLOR
environment variable, and/or command-line options to turn it back on.
For example, pip's CI (#10830):
However, Rich doesn't support FORCE_COLOR
, meaning we get monochrome output:
Compare with nox:
https://github.com/pypa/pip/runs/5177210581?check_suite_focus=true
And pytest:
https://github.com/pytest-dev/pytest/runs/5185781927?check_suite_focus=true
For reference:
This would benefit not just users of pip, but users of other software which uses Rich as a colour/style library, and mean they do not need to implement it themselves, and Rich would be on par with other colour libraries.