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

Light themes are using badly supported urwid "bright background colors" #668

Open
hwalinga opened this issue Nov 29, 2024 · 3 comments
Open
Labels

Comments

@hwalinga
Copy link

Describe the bug
The light themes of pudb use badly supported "bright background colors" https://urwid.org/manual/displayattributes.html#bright-background-colors

To Reproduce
Steps to reproduce the behavior:

  1. Use something like urxvt or xfce-terminal (works fine on xterm or kitty)
  2. Select a light theme (solarized or vim)
  3. See black horror with unreadable text

Expected behavior
I hope that there can at least be some nice light themes that does not use the badly supported "bright background colors". Now the only ones are mono and gray-light-256, which is not a great selection.

Screenshots
This is the theme "vim" on urxvt:

image

Solution
We could revert to a supported background color from urwid. But I do not know how well the "light gray" works with the current light themes. The alternative is to set the background color of the themes to just "default" and let the terminal set the correct background color for the theme.

I can make also make a PR with a light theme of my own hand which relies on the background of the terminal instead.

Versions

This problem arised after the theme overhaul after version 2021.1. Before that, some themes used "default" instead for the background color and I have always been a happy user of midnight on my light themed terminal that worked just fine. I made a new "midday" theme in the new framework that looks just like that.

@mvanderkamp I believe you did the theme overhaul.

@hwalinga hwalinga added the Bug label Nov 29, 2024
@inducer
Copy link
Owner

inducer commented Nov 29, 2024

Thanks for flagging that discussion in the Urwid docs! I agree that these light backgrounds are... not as beautiful as they could be. A PR to fix this would be very welcome, even if it only works in high-color modes.

@mvanderkamp
Copy link
Contributor

Oh interesting! I use xfce-terminal in my home setup and haven't encountered this.

  • Are you using a light theme for the terminal? Is it a default or custom one?
  • Which versions of xfce-terminal and urxvt are you using?

A new light theme would definitely be welcome! I'll have to think about that bright colour support thing. I added the mono theme specifically to make sure there's always at least one useful theme.

The themes are very susceptible to user's settings. Does it make more sense to use the foreground/background colours instead of black/white? And if so, for which parts of the UI? For some terminals the default fore/background could be problematic for syntax highlighting (e.g. if Ubuntu still uses a purple default).

It might be neat if we had a theme that only used 8 colours + the foreground & background, for impacted users. It would be interesting to see if it could work as either light or dark.

@hwalinga
Copy link
Author

I set my theme in ~/.Xdefaults

*.foreground:#4d4d4c
*.background:#EEEEEE
*.color0: #4d4d4c
*.color1: #CC0000
*.color2: #4E9A06
*.color3: #C4A000
*.color4: #3465A4
*.color5: #75507B
*.color6: #06989A
*.color7: #D3D7CF
*.color8: #555753
*.color9: #EF2929
*.color10:#8AE234
*.color11:#FCE94F
*.color12:#729FCF
*.color13:#AD7FA8
*.color14:#34E2E2
*.color15:#4d4d4c
*.colorBD:#4d4d4c

Works for both xfce-terminal and urxvt.

xfce4-terminal 1.1.3 (Xfce 4.18)

rxvt-unicode (urxvt) v9.30 - released: 2021-11-27


I believe setting the "selectable" to use the default background and text would be a good idea, and then the "background" to a color or just "light gray". And also things like input and command line to defaults then. But I am just not sure what is all affected by what. A guide on that would be nice.


My "midday" (old pudb midnight) works pretty good on black and white backgrounds.

Here it is if you want to give it a spin, can be perfected I believe, but I just have a hard time understanding what every element is.

from pudb.themes.utils import add_setting, link


# Based on old pudb midnight theme
link("current breakpoint", "current frame name")
link("focused current breakpoint", "focused current frame name")

palette_dict = {
    # {{{ base styles
    "background": ("black", "light gray"),
    "selectable": ("default", "default"),
    "focused selectable": ("black", "dark green"),
    "hotkey": (add_setting("black", "underline, italics"), "light gray"),
    "highlighted": ("black", "dark green"),
    # }}}
    # {{{ general ui
    "input": ("default", "default"),
    "focused input": ("light green", "default"),
    "warning": (add_setting("black", "bold"), "dark red"),
    "dialog title": (add_setting("black", "bold"), "dark blue"),
    "group head": (add_setting("dark blue", "bold"), "default"),
    "button": (add_setting("black", "bold"), "dark blue"),
    "focused button": ("black", "default"),
    "focused sidebar": ("black", "light gray"),
    "value": (add_setting("yellow", "bold"), "dark blue"),
    # }}}
    # {{{ source view
    "source": (add_setting("black", "bold"), "default"),
    "focused source": (add_setting("black", "bold"), "dark green"),
    "highlighted source": (add_setting("black", "bold"), "light gray"),

    "current source": (add_setting("black", "bold"), "light gray"),
    "current focused source": (add_setting("black", "bold"), "brown"),
    "breakpoint source": (add_setting("black", "bold"), "dark red"),
    "current breakpoint source": (add_setting("yellow", "bold"), "dark red"),

    "line number": ("black", "default"),
    "current line marker": ("dark red", "default"),
    "breakpoint marker": ("dark red", "default"),
    # }}}
    # {{{ sidebar
    "sidebar one": (add_setting("black", "bold"), "default"),
    "sidebar two": ("light blue", "default"),
    "sidebar three": ("light cyan", "default"),
    # }}}
    # {{{ variables view
    "return label": ("black", "dark blue"),
    "return value": ("light gray", "dark cyan"),
    "focused return label": ("light gray", "dark blue"),
    "variable separator": ("light gray", "default"),
    # }}}
    # {{{ stack
    "current frame name": (add_setting("black", "bold"), "default"),
    "current frame class": (add_setting("light blue", "bold"), "default"),
    "current frame location": (add_setting("light cyan", "bold"), "default"),

    "focused current frame name": (add_setting("black", "bold"), "dark green"),
    "focused current frame class": (add_setting("black", "bold"), "dark green"),
    "focused current frame location": (add_setting("black", "bold"), "dark green"),
    # }}}
    # {{{ breakpoints view
    "breakpoint": ("black", "default"),
    "disabled breakpoint": ("dark gray", "default"),
    "focused disabled breakpoint": ("light gray", "dark blue"),
    "current breakpoint": (add_setting("black", "bold"), "default"),
    "disabled current breakpoint": (add_setting("dark gray", "bold"), "default"),
    "focused current breakpoint": (add_setting("black", "bold"), "dark blue"),
    "focused disabled current breakpoint": (
        add_setting("light gray", "bold"), "dark blue"),
    # }}}
    # {{{ shell
    "command line edit": ("default", "default"),
    "command line prompt": (add_setting("default", "bold"), "default"),

    "command line input": ("default", "default"),
    "command line error": (add_setting("light red", "bold"), "default"),

    "command line clear button": (add_setting("black", "bold"), "default"),
    "command line focused button": ("black", "dark blue"),
    # }}}
    # {{{ Code syntax
    "keyword": ("dark magenta", "default"),
    "operator": ("dark gray", "default"),
    "pseudo": ("light magenta", "default"),
    "function": (add_setting("light blue", "bold"), "default"),
    "builtin": ("dark gray", "default"),
    "literal": ("dark cyan", "default"),
    "string": ("dark red", "default"),
    "docstring": ("dark red", "default"),
    "backtick": ("black", "default"),
    "punctuation": (add_setting("black", "bold"), "default"),
    "comment": ("light green", "default"),
    "exception": ("dark green", "default"),
    # }}}
}

palette.update(palette_dict)

# vim: foldmethod=marker

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

No branches or pull requests

3 participants