// Runs before the stylesheet so the first paint already has the right paper. // A classic script on purpose: it must not wait for imports or a module graph. ;(function () { var key = 'substandard.theme' var choice = 'system' try { var stored = localStorage.getItem(key) if (stored === 'light' || stored === 'dark') choice = stored } catch (error) { // Storage can be unavailable in a locked-down profile; system is still right. } var dark = choice === 'dark' || (choice === 'system' && typeof matchMedia === 'function' && matchMedia('(prefers-color-scheme: dark)').matches) document.documentElement.dataset.theme = dark ? 'dark' : 'light' document.documentElement.dataset.choice = choice document.documentElement.style.colorScheme = dark ? 'dark' : 'light' })()