-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
dark mode for AMP pages (it should be automatic) #20951
Comments
We're looking to do this as well, plus give the user a choice of auto / dark / normal, and save the preference in a cookie or localstorage. What needs to happen to make these work? |
I think there also needs to be support for a user to set some persistent preference to indicate whether they want dark mode or light mode. This preference could then be applied in the page, for example, by cc @tomayac |
It would be great if the dark mode preference could persist with the user as they navigate between arbitrary AMP pages across multiple origins, though this has some privacy implications. |
The requirements you mentioned are all covered by my |
The only way to do this in AMP currently as I can tell is use |
OK, this approach using |
Do we maybe need a special component for dark mode? One that would support storing preferences for auto/light/dark? |
I've implemented Prefers-color-scheme into my AMP site, this works perfectly for enabling dark mode on my site when the system is set to dark mode. |
Sure, getting it to work is perfectly feasible. The discussion in the lower part of the thread is around a toggle as in the footer on v8.dev. |
Here's a codepen with a simple theme switcher for dark and light mode (note that this does not adhere to |
Any news on this? |
Definitely need a fix for this. While relying on prefers-color-scheme is an option, it's not ideal. Just because I prefer light scheme globally doesn't mean I don't wish to have some websites in dark mode. |
Hello 👋, I have added an initial draft PR #36958 to add support for the dark theme. I have registered a global action that can be used to toggle the dark theme mode classes on the body and store the user's preferences in local storage and by default relies on |
apologies if this is already being worked on or has already been ruled out but AMP provides an amazing opportunity to easily, quickly and properly make a 'dark mode' for a huge amount of web pages. More companies are looking at doing this for normal webpages (Samsung Internet Browser, Firefox on iOS and now Google Chrome, see this post for more info https://9to5google.com/2019/02/19/android-chrome-webview-web-dark-mode/ ) . Of course it would be ideal if this would happen automatically (if your OS or browser is set to dark mode, AMP should be able to see this and serve up a dark version of the AMP page).
The text was updated successfully, but these errors were encountered: