Open MaxVerevkin opened 12 months ago
Duplicate of https://github.com/helix-editor/helix/issues/2158
Well ok technically not quite the same, I'll leave it open for opinions
This is probably simpler/smaller to add than #2158 (we can query the host terminal for the current background color, right?) but would be less powerful - there wouldn't be any automatic switching when the OS switches between day/night unless we were constantly polling. We could check again on config reload (so you would script something to send all Helix instances the USR1
signal when the OS switches) but if you're doing that then it isn't much more complicated to also swap configs in the external script between light and dark themes. IMO it is still better to accomplish this outside of Helix.
we can query the host terminal for the current background color, right?
Yes, neovim
does that.
swap configs in the external script
I do this with kitty
, but only because I can include config files from my main configuration. Keeping two copies of the same config is not ideal.
What some people do instead is have theme = "theme.toml
and then just swap the files (rather than editing the config) for the theme they want to use, and then reload the config.
Bat just merged in auto theme switching based on terminal color using a custom library called terminal colorsaurus, which is written in rust and is published as a crate. Delta also uses that library since version 0.17, March of this year
With the next release it even seems to be supporting windows with the terminal app.
So MacOS, Linux and Windows are supported with most to pretty much all terminal emulators working, see here.
I think this issue should be revisited
Originally posted by @Axolord in https://github.com/helix-editor/helix/discussions/10281#discussioncomment-11246639
Query the terminal background color and choose a dark or light variant of a theme accordingly. This would be very convenient for people who switch between light/dark terminal themes.