Files
Auto-Trader/frontend/public/theme-boot.js
T
Haozhe Wu 71933ecf31 feat(frontend): guided-minimalism WebUI overhaul — 12-way audit + fix fleet
Land the pre-talk WebUI campaign: first-frame stability (pre-paint theme
boot via CSP-safe public/theme-boot.js, self-hosted fonts + OFL license),
streaming performance (rAF token batching, throttled flush, streaming
markdown with deferred highlight, 160-row windowing, swarm state in its
own store slice with per-run coalescing), correctness (FIFO tool matching,
retry preserves request semantics, display/request separation, cache-hit
session refresh, multi-tab message.received), guided-minimalism welcome
(time-aware greeting + brand lockup + 4 quick actions + collapsible
library, fill-first affordance), SwarmDashboard rebuild with honest
indeterminate progress, five-locale copy de-jargoning with lazy locale
chunks, accessibility Level-A fixes (color-blind metric glyphs, aria-live
streaming, skip link, focus-visible affordances), robustness (markdown
link/table/KaTeX overflow, safe localStorage, portal modal), and '/' now
opens the product with marketing moved to /about.
2026-07-29 23:07:35 +08:00

24 lines
726 B
JavaScript

(() => {
const root = document.documentElement;
let savedTheme = null;
try {
savedTheme = window.localStorage.getItem("qa-theme");
} catch {
// Storage can be unavailable in restricted iframes and WebViews.
}
let prefersDark = false;
if (savedTheme !== "dark" && savedTheme !== "light" && typeof window.matchMedia === "function") {
try {
prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
} catch {
// Fall back to light when the media-query API is present but unusable.
}
}
const dark = savedTheme === "dark" || (savedTheme !== "light" && prefersDark);
root.classList.toggle("dark", dark);
root.style.colorScheme = dark ? "dark" : "light";
})();