assets/js/main.js
// Detect the color scheme the operating system prefers.
Detect the color scheme the operating system prefers.
Detect the color scheme the operating system prefers .
function detectOSColorTheme() {
  if (chosenThemeIsDark) {
    document.documentElement.setAttribute("data-theme", "dark");
  } else if (chosenThemeIsLight) {
    document.documentElement.setAttribute("data-theme", "light");
  } else if (window.matchMedia("(prefers-color-scheme: dark)").matches) {
    document.documentElement.setAttribute("data-theme", "dark");
  } else {
    document.documentElement.setAttribute("data-theme", "light");
  }
}
function detectOSColorTheme ( ) { if ( chosenThemeIsDark ) { document . documentElement . setAttribute ( "data-theme" , "dark" ) ; } else if ( chosenThemeIsLight ) { document . documentElement . setAttribute ( "data-theme" , "light" ) ; } else if ( window . matchMedia ( "(prefers-color-scheme: dark)" ) . matches ) { document . documentElement . setAttribute ( "data-theme" , "dark" ) ; } else { document . documentElement . setAttribute ( "data-theme" , "light" ) ; } }
Detect the color scheme the operating system prefers.
Detect the color scheme the operating system prefers .