File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 16
16
<script >var uiRootPath = ' {{{uiRootPath}}}' </script >
17
17
18
18
<script >
19
- const setTheme = () => {
19
+ function setTheme () {
20
20
var localStorage = window .localStorage .getItem (" themePreference" );
21
21
var systemPreference = window .matchMedia (" (prefers-color-scheme: dark)" ).matches ? " dark" : " light" ;
22
22
23
- if (! localStorage) {
23
+ if (localStorage !== " dark " && localStorage !== " light " ) {
24
24
document .documentElement .setAttribute (" data-theme" , systemPreference);
25
25
document .documentElement .setAttribute (" data-theme-system" , true );
26
+ window .localStorage .removeItem (" themePreference" );
26
27
} else {
27
28
document .documentElement .setAttribute (" data-theme" , localStorage);
28
29
}
29
- }
30
- setTheme ()
30
+ };
31
+ setTheme ();
31
32
</script >
You can’t perform that action at this time.
0 commit comments