I cannot enable light mode by default, even though I have both
disableDarkMode: false,
defaultDarkMode: false
I have tried playing around with both options. No luck.
Can you provide more details? Demo or repo? Steps to reproduce?
Hi @EthanSK
Can you also verify that your computer/browser does not indicate a color scheme preference?
This per-user preference overrides the Docusaurus default.
You can know if you prefer the dark mode by running: window.matchMedia('(prefers-color-scheme: dark)').matches
Please reopen after providing the repo steps. The issue templates were created to help us help you, please do not ignore it.
window.matchMedia('(prefers-color-scheme: dark)').matches
Ah! Didn't even know this existed. My system theme was dark, so it was going dark despite defaultDarkMode: false or disableDarkMode: true in the docusaurus config.
Maybe it might be confusing/unwanted behaviour to have this, because there is currently no way to enforce either a default colour , or a colour full stop.
For example, if my Mac's system settings are on dark mode, I cannot with the current system have docusaurus light by default, or light only (without the option to switch) I really think there should be more options in the docusaurus config to overwrite prefers-color-scheme, or just change the behaviour
@EthanSK I agree there's something not totally ok with current settings and some things might be impossible
What do you want exactly? You want to setup a default theme to light or dark (which one?), even if user has a default preference?
@slorber For me specifically, I would like to set up a default theme to light, even if the user has a default dark system preference.
But I can imagine some other people might want it the other way round - default to dark even if user has a default light system preference.
I think the way it should be done is both defaultDarkMode and disableDarkMode should completely ignore the system preferences, and the developer has to explicitly enable somethnig like prioritizeSystemTheme to be able to use that.
@EthanSK what do you think of this PR?
@EthanSK what do you think of this PR?
2939
lgtm, thanks!
Hey all, this is feature is now released!
If you like it, don't forget to retweet 馃槃
https://twitter.com/docusaurus/status/1286715187983048704