File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed
Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -6,13 +6,10 @@ export default memo(
66 const { [ themes . auto ] : _ , ...colors } = palette
77 const classList = Object . values ( colors ) . join ( "','" )
88 const preferredTheme = `localStorage.getItem('${ storageKey } ')`
9- const fallbackTheme =
10- defaultTheme && defaultTheme !== themes . auto
11- ? `'${ getColorByTheme ( defaultTheme ) } '`
12- : `(window.matchMedia('(prefers-color-scheme: ${ colors . dark } )').matches?'${ colors . dark } ':'${ colors . light } ')`
9+ const fallbackTheme = `(window.matchMedia('(prefers-color-scheme: ${ colors . dark } )').matches?'${ colors . dark } ':'${ colors . light } ')`
1310 const script =
1411 '(function(root){' +
15- `const pref=${ preferredTheme } ;` +
12+ `const pref=${ preferredTheme } ??' ${ getColorByTheme ( defaultTheme ) } ' ;` +
1613 `const theme=(pref&&pref!=='${ themes . auto } ')?pref:${ fallbackTheme } ;` +
1714 `root.classList.remove('${ classList } ');root.classList.add(theme);root.style.colorScheme=theme;` +
1815 `})(document.documentElement)`
You can’t perform that action at this time.
0 commit comments