Skip to content
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

Use a less red-ish color for the new prompt and non-error colorized traceback text #118626

Open
treyhunner opened this issue May 6, 2024 · 3 comments
Labels
topic-repl Related to the interactive shell type-bug An unexpected behavior, bug, or error

Comments

@treyhunner
Copy link
Member

treyhunner commented May 6, 2024

Bug report

Bug description:

I noticed that 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.

Here's an image which shows how an error message displays in a few fairly popular terminal color schemes.

magenta

I've included both "bold as bright" and not.
Some terminal emulators enable that setting by default while others do not.

Here are 3 more images showing how the prompt and error messages would display if cyan, blue, or green were used instead of magenta.

cyan
blue
green

A script I used to help generate those images

I couldn't find data on which color schemes are the most widely used, so I took my best guesses from a bit of research.
From the schemes I looked at (Dracula, Nord, Solarized Dark/Light, Gruvbox Dark/Light) I think Cyan, Blue, or Green would look the least like red.

I don't want to start a debate over what color to paint the bike shed, but I think the closeness of the magenta and red colors are important enough to discuss before 3.13.0 lands.

CPython versions tested on:

3.13, CPython main branch

Operating systems tested on:

Linux

@treyhunner treyhunner added the type-bug An unexpected behavior, bug, or error label May 6, 2024
@nineteendo
Copy link
Contributor

Hmm, sounds more like an enhancement than a bug.

@hugovk
Copy link
Member

hugovk commented May 6, 2024

Regarding bug/feature, I think this is something we can tweak during beta, so let's keep the bug label.

I like the suggestion. We could keep the exception name (ZeroDivisionError) magenta/red-ish.

For example compare GitHub's pytb highlighter:

>>> 4 / 0
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    4 / 0
    ~~^~~
ZeroDivisionError: division by zero

I think Pygments does something similar.

@treyhunner
Copy link
Member Author

I like the suggestion. We could keep the exception name (ZeroDivisionError) magenta/red-ish.

I agree that the exception name, and even the exception message, in magenta or red seems very appropriate.

@AlexWaygood AlexWaygood added the topic-repl Related to the interactive shell label May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-repl Related to the interactive shell type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

4 participants