// Sets the light or dark theme before the first paint, so the page does not flash in the wrong theme. A file of its own // (not an inline script) because the host allows scripts from its own origin only (Content-Security-Policy script-src 'self'). (function () { var stored = null; try { stored = localStorage.getItem('cms-theme'); } catch (e) { stored = null; } var theme = stored === 'light' || stored === 'dark' ? stored : (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'); document.documentElement.classList.add(theme); })();