// Sets the stored theme and motion overrides on before the first paint. // The app applies them again once it mounts (`useApplyThemeOverride`, // `useApplyMotionOverride`), but that is after the page has painted, so a light // OS showed a light flash before the dark default took over. This runs from a // blocking script in the head, as the page's policy allows no inline script. The // keys and the fallbacks ("dark" for the theme, "system" for motion) are those of // `shell/Shell.tsx`; `test/theme-boot.test.mjs` keeps them in step. (function () { function read(key, fallback) { try { var raw = localStorage.getItem(key); return raw === null ? fallback : JSON.parse(raw); } catch (e) { return fallback; } } var root = document.documentElement; var theme = read("swarm-ui:theme-override", "dark"); if (theme === "light" || theme === "dark") root.dataset.theme = theme; var motion = read("swarm-ui:motion-override", "system"); if (motion === "reduce" || motion === "allow") root.dataset.motion = motion; })();