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

Set dark theme even for login screen #4688

Open
kevinpapst opened this issue Mar 7, 2024 Discussed in #4687 · 3 comments
Open

Set dark theme even for login screen #4688

kevinpapst opened this issue Mar 7, 2024 Discussed in #4687 · 3 comments

Comments

@kevinpapst
Copy link
Member

Discussed in #4687

Originally posted by TheZoker March 7, 2024
Hi there,

I noticed, that only after I log in, the theme switches to a dark theme.
How can I set the application to have the dark theme by default and therefore also use it on the login screen?

Thanks!

@kevinpapst kevinpapst added this to the Accepted milestone Mar 7, 2024
@silverwind
Copy link

silverwind commented Mar 9, 2024

Should have three themes: dark,light,auto. Default to auto which derives its initial value from prefers-color-scheme. Auto theme could be as simple as

@import "./light.css" (prefers-color-scheme: light);
@import "./dark.css" (prefers-color-scheme: dark);

@kevinpapst
Copy link
Member Author

Thanks @silverwind - I'd wish developer life would ever be as easy as it seems at the first glance 😁

@kevinpapst kevinpapst modified the milestones: Accepted, Planned features Mar 11, 2024
@joho1968
Copy link
Contributor

joho1968 commented Apr 3, 2024

For what it's worth, in some of the "dashboard" like applications I've been writing lately, I've added a display mode switch like toggle in the upper right hand corner, it will, apart from actually switching the theme, also set a cookie. The cookie overrides whatever the user's preference is set to, allowing them to use dark mode on some clients, light mode on others, and whatever they have configured as the default.

Which means I also add an event listener like so:

window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', updateTheme);

@kevinpapst kevinpapst modified the milestone: Planned features May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Planned
Development

No branches or pull requests

3 participants