GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Use a less red-ish color for the new prompt and non-error colorized traceback text · Issue #118626 · python/cpython

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

New issue
Copy link
New issue
Copy link
Closed as duplicate
Closed as duplicate
Use a less red-ish color for the new prompt and non-error colorized traceback text#118626
Copy link
Labels
topic-replRelated to the interactive shellRelated to the interactive shelltype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@treyhunner
treyhunner
opened on May 6, 2024
Issue body actions

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

Linked PRs

  • gh-118626: Use less red-ish colour for non-error traceback #119966
Reacted by Serban Giuroiu, Tom Gillam and Duncan Holm

Activity

  1. treyhunner
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on May 6, 2024
  2. nineteendo commented on May 6, 2024

    @nineteendo
    nineteendo
    on May 6, 2024
    Contributor
    More actions

    Hmm, sounds more like an enhancement than a bug.

  3. hugovk commented on May 6, 2024

    @hugovk
    hugovk
    on May 6, 2024
    Member
    More actions

    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
    >>> 3.to_bytes(1, 'little')"
      File "<string>", line 1
        3.to_bytes(1, 'little')
         ^
    SyntaxError: invalid decimal literal

    I think Pygments does something similar.

  4. treyhunner commented on May 6, 2024

    @treyhunner
    treyhunner
    on May 6, 2024
    MemberAuthor
    More actions

    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.

  5. AlexWaygood
    added
    topic-replRelated to the interactive shellRelated to the interactive shell
    on May 10, 2024
  6. hugovk commented on Jun 2, 2024

    @hugovk
    hugovk
    on Jun 2, 2024
    Member
    More actions

    Here's a suggestion.

    I'm trying to mirror something like GitHub's pytb colour groups to avoid having too many colours:

    >>> 4 / 0
    Traceback (most recent call last):
      File "<python-input-0>", line 1, in <module>
        4 / 0
        ~~^~~
    ZeroDivisionError: division by zero
    >>>
    >>> 3.to_bytes(1, 'little')"
      File "<string>", line 1
        3.to_bytes(1, 'little')
         ^
    SyntaxError: invalid decimal literal

    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.

    Before image image
    After image image
    GitHub pytb image image

    What do you think?

    Reacted by Nice Zombies
  7. hugovk commented on Jun 3, 2024

    @hugovk
    hugovk
    on Jun 3, 2024
    Member
    More actions

    And a longer traceback using this script based on a test:

    2.py
    def foo(*args):
        x = {'a': {'b': None}}
        y = x['a']['b']['c']
    
    
    def baz2(*args):
        return (lambda *args: foo(*args))(1, 2, 3, 4)
    
    
    def baz1(*args):
        return baz2(1, 2, 3, 4)
    
    
    def bar():
        return baz1(1,
                    2, 3
                    , 4)
    
    
    bar()
    pytb
    ❯ ./python.exe 2.py
    Traceback (most recent call last):
      File "/Users/hugo/github/python/cpython/main/2.py", line 20, in <module>
        bar()
        ~~~^^
      File "/Users/hugo/github/python/cpython/main/2.py", line 15, in bar
        return baz1(1,
                    2, 3
                    , 4)
      File "/Users/hugo/github/python/cpython/main/2.py", line 11, in baz1
        return baz2(1, 2, 3, 4)
      File "/Users/hugo/github/python/cpython/main/2.py", line 7, in baz2
        return (lambda *args: foo(*args))(1, 2, 3, 4)
               ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
      File "/Users/hugo/github/python/cpython/main/2.py", line 7, in <lambda>
        return (lambda *args: foo(*args))(1, 2, 3, 4)
                              ~~~^^^^^^^
      File "/Users/hugo/github/python/cpython/main/2.py", line 3, in foo
        y = x['a']['b']['c']
            ~~~~~~~~~~~^^^^^
    TypeError: 'NoneType' object is not subscriptable
    Before image image
    After image image
    GitHub pytb image image
    Reacted by Nice Zombies
  8. hugovk commented on May 4, 2025

    @hugovk
    hugovk
    on May 4, 2025
    Member
    More actions

    Closing in favour of theming support: #133346

  9. hugovk
    closed this as completedon May 4, 2025
  10. hugovk
    closed this as a duplicateof Theming support for _colorize #133346 on May 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic-replRelated to the interactive shellRelated to the interactive shelltype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.