Darren Burns
banner
darren.bsky.social
Darren Burns
@darren.bsky.social
Software engineer 💻, fantasy book enjoyer 📚, 日本語 learner 🇯🇵

Building posting.sh, the HTTP client that runs in the terminal.

https://darren.codes
The `ansi_theme_dark` reactive only affects things if you use ANSI colors in your markup. It's unrelated to *Textual* themes.

Textual themes only change the values in the CSS design system variables, like $primary, $accent, $surface, etc. Textual themes will never change the value of `red`.
March 9, 2025 at 6:29 PM
Yep, if you're just going straight to hex or RGB tuples then there's nothing to think about :)

In Textual 1, if you write `red` in markup it gives Monokai-purple-red, unless you do the thing I shared above.

In Textual 2, it gives web-color red (255, 0, 0), which happens to match ANSI bright_red.
March 9, 2025 at 6:29 PM
(Screenshot is from Textual 1.0)
March 9, 2025 at 6:14 PM
Ah ok. I was originally thinking something like this (makes it so that red is actually red and not the Monokai purple-red shade).

Although on trying it I realised the new Textual 2 markup uses web colours, so "red" now corresponds to ANSI bright_red rather than the Monokai shade.
March 9, 2025 at 6:14 PM
It may well be different, it’s all a bit fuzzy 😄
March 9, 2025 at 5:39 PM
I see - I believe that reactive does exactly what you need then if I understand correctly. It’ll map the colour codes (0-15, e.g. ansi_blue) to an RGB value that is unaffected by theme (although you’ll have to set the light & dark reactives).
The default maps to Monokai colours because reasons 😆
March 9, 2025 at 4:20 PM
Did you use `App.ansi_theme_dark` here?
March 9, 2025 at 1:43 PM
Indeed.
Thanks Rodrigo!
January 4, 2025 at 3:16 PM
Thank you!
January 4, 2025 at 3:15 PM