File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -643,7 +643,8 @@ var DarkMode = {
643643 theme = document . documentElement . dataset . theme === "dark" ? "light" : "dark"
644644 }
645645 document . documentElement . dataset . theme = theme
646- localStorage . setItem ( "theme" , theme ) ;
646+ if ( prefersDarkScheme === ( theme === "dark" ) ) localStorage . removeItem ( "theme" ) ;
647+ else localStorage . setItem ( "theme" , theme ) ;
647648 button . attr ( "src" , `${ baseURLPrefix } images/${ theme === "dark" ? "light" : "dark" } -mode.svg` ) ;
648649 } ) ;
649650 } ,
Original file line number Diff line number Diff line change @@ -49,7 +49,8 @@ <h1>Redirecting…</h1>
4949 if ( currentTheme ) {
5050 // Check dark mode preference at the OS level
5151 const prefersDarkScheme = window . matchMedia ( "(prefers-color-scheme: dark)" ) . matches
52- if ( ( prefersDarkScheme && currentTheme === "light" )
52+ if ( prefersDarkScheme === ( currentTheme === "dark" ) ) localStorage . removeItem ( "theme" )
53+ else if ( ( prefersDarkScheme && currentTheme === "light" )
5354 || ( ! prefersDarkScheme && currentTheme === "dark" ) ) {
5455 document . documentElement . dataset . theme = currentTheme
5556 }
You can’t perform that action at this time.
0 commit comments