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

Automatically select light/dark theme variant #8899

Open
MaxVerevkin opened this issue Nov 24, 2023 · 6 comments · May be fixed by #12098 or #12362
Open

Automatically select light/dark theme variant #8899

MaxVerevkin opened this issue Nov 24, 2023 · 6 comments · May be fixed by #12098 or #12362
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements S-needs-discussion Status: Needs discussion or design.

Comments

@MaxVerevkin
Copy link

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.

@MaxVerevkin MaxVerevkin added the C-enhancement Category: Improvements label Nov 24, 2023
@archseer
Copy link
Member

Duplicate of #2158

@archseer archseer marked this as a duplicate of #2158 Nov 24, 2023
@archseer
Copy link
Member

Well ok technically not quite the same, I'll leave it open for opinions

@archseer archseer reopened this Nov 24, 2023
@the-mikedavis
Copy link
Member

the-mikedavis commented Nov 25, 2023

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.

@MaxVerevkin
Copy link
Author

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.

@kirawi
Copy link
Member

kirawi commented Nov 26, 2023

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.

@kirawi kirawi added A-helix-term Area: Helix term improvements S-needs-discussion Status: Needs discussion or design. labels Jan 23, 2024
@Axolord
Copy link

Axolord commented Nov 13, 2024

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 #10281 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements S-needs-discussion Status: Needs discussion or design.
Projects
None yet
5 participants