pytest: Dark-red coloured crash stack dump is very hard to read on a dark-themed terminal
When there is a problem in the Python code that crashes the interpeter, like
def test_something():
/boom # syntax error
you get the following colored output:
Depending on the light from the environment, this is hard to impossible to read.
OS: Fedora 30, python package versions etc are in the schreenshot.
About this issue
- Original URL
- State: open
- Created 4 years ago
- Comments: 21 (16 by maintainers)
@michjnich I indeed didn’t consider the case of the same color causing issues in other combinations. Apologies and thanks for the clarification and details!
@RonnyPfannschmidt An env var override setting would be fine too, imho. And perhaps this is the simplest solution, as it would just default to what’s already there if not set.
@The-Compiler I can’t read that first image at all - it’s basically invisible text to me.
I know I can change terminal settings, and in fact I do, the problem is, different things use different colours and colour combos, so if I change the value of “red” in the terminal to be eg. light orange, pytest might look fine, but some other utility might have yellow on red, which would then be yellow on light orange - yet another combo I couldn’t see. Every time a different util that makes use of colour is used, it just adds to the complexity and reduces the chances of being able to find any combo of terminal settings that work for everything.
With git, I can set the colours for each text type in my .gitconfig without actually changing the meaning of “red”, and potentially causing some colour conflict in another util.
Bottom line is, around 12% of people are colourblind. More are sight-impaired in some other way that can be impacted by poor colour choices. If you’re curious about any particular colour combo, I can recommend https://whocanuse.com.
The only real solution that doesn’t cause conflicts with other utils, is to allow users to override colour choices for each util individually.
@EmilStenstrom What you’re seeing there is actually Pygment’s code syntax highlighting - also see #7132 for that.