File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 1818 // ignore errors e.g. when media query matching is not supported
1919 }
2020
21- // Detects whether the dartdoc control was set to use dark theme
22- let dartdocDarkThemeIsSet = window . localStorage . getItem ( 'colorTheme' ) == 'true' ;
21+ // Detects whether the control widget was set to use a specific theme
22+ let colorTheme = window . localStorage . getItem ( 'colorTheme' ) ;
23+ let lightThemeIsSet = colorTheme == 'false' ;
24+ let darkThemeIsSet = colorTheme == 'true' ;
2325
24- // Switch the top-level style marker to use dark theme instead of the light theme default.
25- if ( mediaPrefersDarkScheme || dartdocDarkThemeIsSet ) {
26+ if ( lightThemeIsSet ) {
27+ // nothing to do here, the default style is the light-theme
28+ } else if ( mediaPrefersDarkScheme || darkThemeIsSet ) {
29+ // switch to the dark theme
2630 document . body . classList . remove ( 'light-theme' ) ;
2731 document . body . classList . add ( 'dark-theme' ) ;
2832 }
You can’t perform that action at this time.
0 commit comments