SPB Git

Repository Public

theme-init.js 764 B 16 lines javascript

1/* Applies the stored theme before first paint. External + same-origin because the CSP forbids2   inline scripts. Stores nothing sensitive: the theme is "light" | "dark" | "system". */3(function () {4  var root = document.documentElement;5  try {6    var pref = localStorage.getItem('aos.theme') || 'light';7    var dark = pref === 'dark' || (pref === 'system' && window.matchMedia('(prefers-color-scheme: dark)').matches);8    root.setAttribute('data-theme', dark ? 'dark' : 'light');9    root.setAttribute('data-theme-pref', pref);10    var meta = document.querySelector('meta[name="theme-color"]');11    if (meta) meta.setAttribute('content', dark ? '#080B10' : '#F7F6F3');12  } catch (e) {13    /* storage unavailable: the CSS default (light) applies */14  }15})();16
Files main
Menu

Theme