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

White text on yellow background is not visible #37

Open
10b14224cc opened this issue May 5, 2024 · 10 comments
Open

White text on yellow background is not visible #37

10b14224cc opened this issue May 5, 2024 · 10 comments

Comments

@10b14224cc
Copy link

This is the error message that is displayed in case of error
image

The yellow background renders the white text not readable.

Can we change background?

Thanks

@Pilgrim1379
Copy link

Screenshot 2024-10-20 at 23 07 32

This also affects code completion options from the terminal in ipython.

@sgoudham
Copy link
Contributor

sgoudham commented Oct 25, 2024

Hey 👋,

This is the error message that is displayed in case of error

Am I right in saying that this is when IPython is configured? I'd like to try and resolve this but I'm not sure how to replicate this scenario off the top of my head.

Could you please provide step by step reproduction instructions including the instructions you followed to install the Catppuccin theme?

Thanks!

@Pilgrim1379
Copy link

In my case I'm using wezterm 20240203-110809-5046fc22 which comes with Catppuccin built-in. I've enabled the theme like so:

local config = {}

-- In newer versions of wezterm, use the config_builder which will
-- help provide clearer error messages
if wezterm.config_builder then config = wezterm.config_builder() end

--- This is where you actually apply your config choices
--- Color scheme
function scheme_for_appearance(appearance)
    if appearance:find "Dark" then
        return "Catppuccin Mocha"
    else
        return "Catppuccin Latte"
    end
end

config.color_scheme = scheme_for_appearance(wezterm.gui.get_appearance())

My ipython_config.py has the following content:

from pygments.styles import get_style_by_name
from pygments.util import ClassNotFound

c = get_config()
c.InteractiveShell.confirm_exit = False
c.InteractiveShell.separate_in = ""
c.TerminalIPythonApp.display_banner = True
try:
    c.TerminalInteractiveShell.highlighting_style = get_style_by_name(
        "catppuccin-mocha"
    )
except ClassNotFound as ex:
    print(f"Failed to set theme: {ex}")

At the prompt I start ipython shown in the screenshot below then type say f and hit TAB.
Screenshot 2024-10-25 at 21 38 09

I hope all this makes sense and thanks for trying to find a solution.

@sgoudham
Copy link
Contributor

Thanks for the reproduction instructions, my results are a bit interesting.

This is my IPython Config:

c = get_config()  #noqa

c.InteractiveShell.confirm_exit = False
c.InteractiveShell.separate_in = ""
c.TerminalIPythonApp.display_banner = True
c.TerminalInteractiveShell.true_color = True
c.TerminalInteractiveShell.highlighting_style = "catppuccin-mocha"

And my wezterm options aren't actually styled in the first place:

image

My WezTerm version is 20230712-072601-f4abf8fd so I'm a bit behind you. I wonder if this is actually related to catppuccin/wezterm#15 in newer versions of WezTerm?

@sgoudham
Copy link
Contributor

With regards to the original issue, unfortunately it looks related to our ANSI colours: https://stackoverflow.com/questions/14129278/how-do-i-customize-text-color-in-ipython

We're in the process of overhauling ANSI colours but I think this is a classic example where the Catppuccin theme doesn't look good with "white" text on accented backgrounds (i.e. red, yellow, green, etc) so we'll need to perform some overrides for IPython to make the text foreground base or crust according to our style guidelines.

@Pilgrim1379
Copy link

Thanks for the reproduction instructions, my results are a bit interesting.

This is my IPython Config:

c = get_config()  #noqa

c.InteractiveShell.confirm_exit = False
c.InteractiveShell.separate_in = ""
c.TerminalIPythonApp.display_banner = True
c.TerminalInteractiveShell.true_color = True
c.TerminalInteractiveShell.highlighting_style = "catppuccin-mocha"

And my wezterm options aren't actually styled in the first place:

image

My WezTerm version is 20230712-072601-f4abf8fd so I'm a bit behind you. I wonder if this is actually related to catppuccin/wezterm#15 in newer versions of WezTerm?

Using the suggestions from the wezterm issue you linked to, I modifed my config to:

config.color_scheme = scheme_for_appearance(wezterm.gui.get_appearance())
config.colors = {indexed = {[16] = "#000000"}} 

and the completion now looks like yours
Screenshot 2024-10-25 at 23 40 45

I can live with this. At least its readable. Thanks a ton for your help.

@backwardspy
Copy link
Member

@Pilgrim1379 it's worth checking if c.TerminalInteractiveShell.true_color = True in your ipython config helps too - it's almost always better. in particular i've noticed using 256 colour (the default on some configurations) breaks the completion menu.

i think the original issue with the yellow background on exception tracebacks is a bad highlight choice that needs to be fixed separately.

@backwardspy
Copy link
Member

@10b14224cc please could you provide some more details about your configuration, terminal emulator, et cetera? i am currently unable to replicate this issue.

image

@10b14224cc
Copy link
Author

10b14224cc commented Oct 26, 2024

I have kitty and the following in my IPython configuration at ~/.ipython/profile_default/ipython_config.py

## Set the color scheme (NoColor, Neutral, Linux, or LightBG).
#  Choices: any of ['Neutral', 'NoColor', 'LightBG', 'Linux'] (case-insensitive)
#  Default: 'Neutral'
c.InteractiveShell.colors = 'Linux'
c.TerminalInteractiveShell.true_color = True
c.TerminalIPythonApp.display_banner = False
try:
    c.TerminalInteractiveShell.highlighting_style = get_style_by_name("catppuccin-macchiato")
except ClassNotFound as ex:
    print(f"Failed to set theme: {ex}")

@backwardspy
Copy link
Member

backwardspy commented Oct 26, 2024

nice, thanks for the info! i realised my terminal emulator was shielding me from this issue by automatically improving contrast in these situations. i've disabled that and i can now replicate the issue. it comes from the InteractiveShell.colors part of the configuration and i don't know if it can be changed.

one workaround for now is to set that to nocolor which, as the name implies, disables colour in tracebacks and so on. syntax highlighting is controlled with TerminalInteractiveShell.highlighting_style so that continues to work.

the outstanding question now is whether the ansi colours used by InteractiveShell.colors can be modified or not.

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

4 participants