-
Notifications
You must be signed in to change notification settings - Fork 280
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
Default theme is light even though it should be dark #201
Comments
FWIW, until this bug is confirmed and resolved, I managed to fix the problem with a workaround solution. I added few lines of JavaScript to if (localStorage.getItem('theme') === null) {
localStorage.setItem('theme', 'dark');
changeModeMeta('dark');
} |
Currently, default theme in Anyhow, I think this is a conflict between user prefers and site owner prefers. And I'm not sure if this is a bug, since MemE's principle is user prefers first. But I think maybe we can do something for this, since dark theme is more special than "old" light theme. Perhaps we can restore the - <html lang="{{ .Site.LanguageCode }}">
+ <html lang="{{ .Site.LanguageCode }}"{{ if and .Site.Params.enableDarkMode (eq .Site.Params.defaultTheme "dark") }} data-theme="dark"{{ end }}> Or add a param in config.toml for site owner to control if MemE should override system preferences? /cc @palant |
Also, with Chrome emulating prefers-color-scheme DevTools, I found MemE doesn't react on dark mode changes anymore, compared with this demo by web.dev. /cc @palant |
Yes, the
It does, for me. You have to clear The only issue I see is the browsers not always determining correctly what the user wants, so |
Actually, looking a bit further the spec does not really specify how browsers are supposed to know whether the user wants a dark theme. However, MDN clearly says "if the user has requested the system use a light or dark color theme" - so only the system theme is relevant, not the browser theme. Also, in Firefox one can set So I guess it's all expected behavior, merely Chrome support for |
Oh, that‘s why! It's a Chorme bug. 😬 But still, I think adding an option for MemE users to choose whether to override system's preferences is a harmless attempt. :) |
Hello,
I'm experiencing a weird problem where default theme is always light, even though I've configured dark in
config.toml
With this configuration, the site renders the light theme by default. If I toggle to dark theme, my browser gets the
theme=dark
key in the local storage and afterwards displays the site correctly with dark theme.I'm using Hugo v0.72.0 and MemE theme v4.4.0.
The text was updated successfully, but these errors were encountered: