Why does light/dark mode not change when the OS light/dark mode changes? #3911
-
I am running into difficulty getting prefers-color-scheme to work based on these directions https://squidfunk.github.io/mkdocs-material/setup/changing-the-colors/#system-preference I tried getting this work in an existing app and was not able to see the page change when I switched my computer from light to dark mode. I was, however, able to see many other websites change (such as Google), so I know that my computer is reporting my color scheme preference correctly. I then thought that maybe the existing app was overriding too many things, so I decided to create a new app with the getting started instructions. I updated the mkdocs.yml file to be this:
and I am still not seeing it pick up my system light mode / dark mode preference. Of note, I am able to manually change the order of those media calls to have the dark mode one first and that does work to set dark mode. So dark mode is working, but automatic detection is not working. I have used google chrome dev tools to easily toggle my preferences Do you know where I might be going wrong? Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
You're doing nothing wrong. Material for MkDocs currently will only set the system preference on the first visit:
I may look into this in the future again, but if you read the above issues, you'll see that it's not trivial to add given the current architecture. However, I understand that this is something that many users want and see if we can change the behavior. |
Beta Was this translation helpful? Give feedback.
You're doing nothing wrong. Material for MkDocs currently will only set the system preference on the first visit:
I may look into this in the future again, but if you read the above issues, you'll see that it's not trivial to add given the current architecture. However, I understand that this is something that many users want and see if we can change the behavior.