mirror of
https://github.com/anand34577/ferrum.git
synced 2026-09-21 18:13:23 +00:00
17 lines
823 B
JavaScript
17 lines
823 B
JavaScript
// Runs before first paint so returning dark-mode users never see a light
|
|
// flash. Kept as an external file so the CSP (script-src 'self') stays
|
|
// free of inline-script allowances.
|
|
(function () {
|
|
try {
|
|
var stored = localStorage.getItem("ferrum-theme");
|
|
var dark = stored === "dark" || (stored !== "light" && window.matchMedia("(prefers-color-scheme: dark)").matches);
|
|
if (dark) document.documentElement.classList.add("dark");
|
|
var look = localStorage.getItem("ferrum-look");
|
|
if (look === "proxmox" || look === "terminal") document.documentElement.dataset.look = look;
|
|
var meta = document.querySelector('meta[name="theme-color"]');
|
|
if (meta) meta.setAttribute("content", dark ? "#090b0e" : "#ffffff");
|
|
} catch {
|
|
/* no storage / no matchMedia — default light theme applies */
|
|
}
|
|
})();
|