-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
gh-118626: Use less red-ish colour for non-error traceback #119966
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hugo, could you change the color of ">>>" as well? It's not magenta for pytb. Or does that need its own PR? cpython/Lib/asyncio/__main__.py Line 101 in 70934fb
Line 466 in 70934fb
|
How keen is @ambv on keeping the magenta prompt?
|
Let's keep the prompt color. In the end we want to make this configurable anyway since there's no way we will keep everybody happy. |
I find the red and magenta combination in the stack trace jarring, and I endorse this pull request with the following suggestion: Given the vast number of environments and terminals that Python runs in, it should stick to a conservative ANSI color palette and avoid the use of “bold” colors since the result of setting the “bold” attribute varies between terminal emulators and user configuration [1] [2]. Using the six basic ANSI colors without any attributes set would be the safest option:
[1] https://invisible-island.net/xterm/xterm.faq.html#bold_vs_16colors |
Last week I made some slides to show the improved error messages coming in 3.13, and used the example from What's New. These have quite big error messages, and I find the blue of this PR (lower example) much better than the original magenta (upper example):
@ambv @pablogsal You've spoken of adding config for all these things, but I think this improves the defaults. What do you think? And cc @treyhunner as issue reporter, what do you think? |
I'm unfortunately very colourblind so I fear my answer here it's going to be very biased and maybe not representative of the average user when selecting the defaults 😕 |
Could you remove the quoted text from your comment? Or only include the question? |
I like the blue that is currently in this PR better (on my color scheme at least). I like the blue prompt in the bottom row of #119966 (comment) even better. I believe @ambv mentioned trying to keep the changes to just 2 colors, so as not to cause visual overwhelm. A note: depending on whether "bold as bright" is enabled on the terminal emulator, the blue may show up as a different color instead (it does in the Solarized Light color scheme). Without "bold text as bright colors" enabled: With "bold text as bright colors" enabled: With the default Ubuntu Terminal settings, the blue looks a bit low contrast: "Bold as bright" fixes that, though this setting does not seem to be the default on Gnome Terminal in Ubuntu 22.04. I believe it is the default on many Mac terminal emulators, but I have not researched this. |
Closing in favour of theming support: #133346 |
Fixes #118626.
The magenta color used by the new REPL and within the non-error text in the new colorized tracebacks in 3.13 looks quite a bit like an error-related color in some popular color schemes.
In this PR, I'm trying to mirror something like GitHub's
pytb
colour groups to avoid having too many colours:In the before and after below, I'm using macOS and have iTerm with a dark theme, and Terminal with light theme (Novel), to make it easy to compare without having to dig in the settings each time.
And a longer traceback using this script based on a test:
2.py
pytb