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

Update background light / dark depending on the system theme #1912

Closed
mgax opened this issue Jun 22, 2023 · 0 comments · Fixed by #1917
Closed

Update background light / dark depending on the system theme #1912

mgax opened this issue Jun 22, 2023 · 0 comments · Fixed by #1917
Labels
enhancement New feature or request

Comments

@mgax
Copy link
Contributor

mgax commented Jun 22, 2023

I'd like Neovide to detect system theme (light / dark) and adjust the 'background' option accordingly.

Neovide should probably listen to winit WindowEvent::ThemeChanged events and update the 'background' option.

Apps that support themes (e.g. Discord) generally allow the user to pick light, dark, or auto, where auto follows the system setting. Neovide should probably offer a similar option since not all uesrs will want their 'background' option to change automatically.

Alternatively, Neovide could provide some sort of hook or event, that a user can subscribe to, by writing code in their configuration file, and they could implement whatever logic to handle it. I don't know enough about neovim to understand if that even makes sense or if it's worth the complexity.

Here's the relevant winit example: https://github.com/rust-windowing/winit/blob/66ff52b0128be9430b32cb5756e124f61d2e67d0/examples/theme.rs#L38-L44. I've tested it on MacOS and it works as expected. Interestingly, if the user overrides the theme by pressing L or D, no ThemeChanged events are triggered when the key is pressed, or when the system theme changes; events are only sent when in Automatic mode.

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

Successfully merging a pull request may close this issue.

1 participant