arrives,
// it paints over and the inline html style becomes invisible.
var ot = themes[override];
if (ot) {
if (ot["background-primary"]) html.style.backgroundColor = ot["background-primary"];
if (ot["text-primary"]) html.style.color = ot["text-primary"];
}
} else {
var pref = "auto";
try { pref = localStorage.getItem("hf:quanta:theme-pref") || "auto"; } catch (e) {}
// Package default is DARK. Render light ONLY when:
// - user explicitly chose pref="light", OR
// - pref="auto" and OS explicitly signals prefers-color-scheme: light
// Any other signal (dark, none, matchMedia missing) resolves to dark.
var light = pref === "light" || (pref === "auto" && matchMedia("(prefers-color-scheme: light)").matches);
var dark = !light;
html.setAttribute("data-theme", "default" + "-" + (dark ? "dark" : "light"));
// 3b. Anti-FOUC for managed themes. Setting color-scheme tells the
// browser to use dark/light system defaults for the canvas (page
// background, native form controls) — no white flash before the
// proper theme/color.css block sets the same property inside its
// :where(...) block.
html.style.colorScheme = dark ? "dark" : "light";
}
})();