File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -337,6 +337,8 @@ let commandPalette = document.getElementById("command-palette");
337337let commandBackdrop = document . getElementById ( "command-backdrop" ) ;
338338let commandInput = document . getElementById ( "command-input" ) ;
339339let commandResults = document . getElementById ( "command-results" ) ;
340+ const themeColorMeta = document . querySelector ( 'meta[name="theme-color"]' ) ;
341+ const colorSchemeMeta = document . querySelector ( 'meta[name="color-scheme"]' ) ;
340342const quizQuestion = document . getElementById ( "quiz-question" ) ;
341343const quizProgress = document . getElementById ( "quiz-progress" ) ;
342344const quizOptions = document . getElementById ( "quiz-options" ) ;
@@ -992,6 +994,16 @@ function applyTheme(theme, notify = false) {
992994 currentTheme = selected ;
993995 document . documentElement . dataset . theme = selected ;
994996 document . body . dataset . theme = selected ;
997+ const isLightTheme = selected === "paper" ;
998+ const computed = getComputedStyle ( document . documentElement ) ;
999+ const bgColor = computed . getPropertyValue ( "--bg-0" ) . trim ( ) ;
1000+ if ( themeColorMeta && bgColor ) {
1001+ themeColorMeta . setAttribute ( "content" , bgColor ) ;
1002+ }
1003+ if ( colorSchemeMeta ) {
1004+ colorSchemeMeta . setAttribute ( "content" , isLightTheme ? "light" : "dark" ) ;
1005+ }
1006+ document . documentElement . style . colorScheme = isLightTheme ? "light" : "dark" ;
9951007 if ( headerThemeSelect ) headerThemeSelect . value = selected ;
9961008 if ( heroName ) {
9971009 if ( selected === "blackflag" && heroName . textContent . trim ( ) . length > 0 ) {
You can’t perform that action at this time.
0 commit comments