-
Notifications
You must be signed in to change notification settings - Fork 815
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
Expose ANSI themes #4119
Comments
I'm not 100% sure I'm following what this is. What is the ANSI theme and how does it relate to the terminal theme/the colours from the design system? |
I'm actually wondering if a developer explicitly specifies ANSI "red" in their code, should we really be modifying that? I actually think it would be astonishing, and a little bit annoying - I think @davep's confusion at standup shows that it's surprising. I understand if we have to modify it to a hex code so we can blend etc, but I'm wondering if it should just be a direct mapping to the ANSI colours (e.g. red -> #ff0000). |
It's covered in the FAQ https://textual.textualize.io/FAQ/#why-doesnt-textual-support-ansi-themes The upshot is that if we don't replace the ANSI colors with RGB, Textual apps may look awful on some user's terminals. |
Yeah, I'm aware of that - I think my first paragraph was poorly worded. Just to be clear I'm suggesting replacing I think changing the actual colour is where it becomes surprising, i.e. if I write If I want the pink/purple/red from Dimmed Monokai, shouldn't I expect as a developer to have to just write out the hex code? |
The thing is these ansi styles can come from a variety of sources. They can come from This only impacts Text and other Rich renderables. If you specify "red" in the CSS you will get a consistent red, as taken from |
I don't understand this at all to be honest. I can't see how they would ever be expecting a conversion here given that we don't respect terminal emulator themes. There are 3 options:
I can honestly say that when I write In Textual, when I write red and expect red, just like in CSS. It's far less surprising than specifying |
Why The ansi colors and CSS colors are different domains where the colors are different. I know its not ideal. In the future I would like to have some non-Rich |
Because having it just match CSS is the least astonishing option. It also feels like we're telling them we know better than them - "you think you want red, but you actually want something defined by us". The app developer can see exactly what end users will see, so where's the benefit in "correcting" their colour choices for them? Telling users "if you write
Textual doesn't respect what The themes also are completely unrelated to the current Textual design system, and are only going to change a subset of the things on screen in a way that's totally inconsistent with the design system. It's extra complexity that I genuinely don't see any benefit to (if It would also add two reactives to
Could this kind of functionality not belong in Textual's theme system? If I set |
Don't forget to star the repository! Follow @textualizeio for Textual updates. |
In Textual we convert ANSI themes into truecolor themes. We always assume
DIMMED_MONOKAI
. We should expose that to the dev, and provide 2 terminal themes for light and dark mode.Suggestions for interface: Two reactives on App that take a Rich
TerminalTheme
instance:dark_terminal_theme
andlight_terminal_theme
. Setting either of these would do a full CSS refresh.The text was updated successfully, but these errors were encountered: