/* * Runs (blocking, same origin, no inline script) before first paint so the page never flashes the * wrong theme. Mirrors resolveInitialMode() in src/theme/tokens.ts (BR-U1-2, BR-U1-5): * variant is always "b"; mode = valid stored mode, else the system preference. */ (function () { var mode = 'light'; try { var stored = window.localStorage.getItem('slp-software-mode'); if (stored === 'light' || stored === 'dark') { mode = stored; } else if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { mode = 'dark'; } } catch (e) { if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { mode = 'dark'; } } var root = document.documentElement; root.setAttribute('data-variant', 'b'); root.setAttribute('data-mode', mode); })();