Closed gradiian closed 2 years ago
This is actually the desired behaviour, as soon as you set the theme by pressing the dark mode toggle a setting is saved in local storage in order to persist your preference, thus prefers-color-scheme
is ignored.
When the page loads the theme checks if a mode preference is stored locally, if it finds it then applies the correct mode based on that value. If there is no preference stored then the mode changes automatically according to the prefers-color-scheme
system preference.
I will close this issue for now, please feel free to open another one if needed.
On initial page load, the
html
tag hasdata-theme="dark"
set which preventsprefers-color-scheme
from being able to change themes automatically. If I manually set it to an empty value:<html data-theme="">
, the theme changes based on the system's theme until it's been overridden by the manual toggle.