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

Highlight colour for errors makes them unreadable #13502

Closed
anentropic opened this issue Jan 30, 2022 · 8 comments
Closed

Highlight colour for errors makes them unreadable #13502

anentropic opened this issue Jan 30, 2022 · 8 comments
Milestone

Comments

@anentropic
Copy link

Screenshot 2022-01-30 at 21 35 52

╰─ ipython
Python 3.9.2 (default, Mar 18 2021, 20:48:06)
Type 'copyright', 'credits' or 'license' for more information
IPython 8.0.1 -- An enhanced Interactive Python. Type '?' for help.

I'm on macos, iTerm2

@Carreau
Copy link
Member

Carreau commented Feb 1, 2022

Duplicate #13446

@Carreau Carreau closed this as completed Feb 1, 2022
@Carreau Carreau added this to the 8.1 milestone Feb 25, 2022
@Hubro
Copy link

Hubro commented Jul 14, 2022

@Carreau The issue you linked to has been locked. Are there any documented workarounds for this? The conversation in the linked issue talks about perhaps using bold, underlined text rather than a background color, but don't include instructions.

This still appears to be an issue in iPython 8.4:

image

(Alacritty with Duskfox theme)

@Lyonsclay
Copy link

There is a temp fix suggested here that works for me; https://stackoverflow.com/a/74681224

@bendavis78
Copy link

bendavis78 commented Mar 23, 2023

Still experiencing this in ipython 8.11.0, I have to use the workaround described in the above comment

image

@Lyonsclay
Copy link

I have a command that opens a new terminal and executes the following code.

from IPython.core import ultratb;ultratb.VerboseTB._tb_highlight = 'bg:ansired';

The output looks like this.

ipython stack trace

@nicos68
Copy link

nicos68 commented Aug 2, 2023

The color of strings is also on the brink of being unreadable, an improvement on it would also be welcome.

@Lyonsclay
Copy link

You can also create an ipython startup script and place it .ipyhon/profile_default/startup/001.py. I'm not sure if the name of the file matters, but that was how I saw in some docs.

# 001.py
import IPython
from IPython.core import ultratb

ultratb.VerboseTB._tb_highlight = 'bg:ansired'

ipython = IPython.get_ipython()
if ipython is not None:
    ipython_version = IPython.__version__
    major_version = int(ipython_version.split('.')[0])
    minor_version = int(ipython_version.split('.')[1])

    if major_version < 8 or (major_version == 8 and minor_version < 1):
        ipython.magic("load_ext autoreload")
        ipython.magic("autoreload 2")
    else:
        ipython.run_line_magic(magic_name="load_ext", line="autoreload")
        ipython.run_line_magic(magic_name="autoreload", line="2")

    print("Autoreload enabled.")
else:
    print("Autoreload not enabled.")

@Carreau
Copy link
Member

Carreau commented Aug 14, 2023

IPython.version_info will give you a pre-parsed version tuple. And in general you can completely customise colors. It's impossible to get defaults that are readable everywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants