const themes = ["system", "dark", "light"]; let theme = window.localStorage.getItem("gractwopl-theme"); if (!themes.includes(theme)) { window.localStorage.setItem("gractwopl-theme", "system"); } theme = window.localStorage.getItem("gractwopl-theme"); if (theme === "system") { if (window.matchMedia("(prefers-color-scheme: dark)").matches) { document.documentElement.classList.add("dark"); } } if (themes.includes(theme)) { document.documentElement.classList.add(theme); }