This commit is contained in:
2026-07-17 15:57:36 +03:00
commit 8f2d798e1a
72 changed files with 6227 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
(() => {
const KEY = "wrapped.theme";
function preferred() {
return localStorage.getItem(KEY) || "dark";
}
function apply(theme) {
document.documentElement.setAttribute("data-theme", theme);
const sun = document.getElementById("theme-icon-sun");
const moon = document.getElementById("theme-icon-moon");
if (sun && moon) {
sun.classList.toggle("hidden", theme !== "light");
moon.classList.toggle("hidden", theme !== "dark");
}
}
function toggle() {
const next = preferred() === "dark" ? "light" : "dark";
localStorage.setItem(KEY, next);
apply(next);
}
apply(preferred());
document.addEventListener("DOMContentLoaded", () => {
apply(preferred());
const btn = document.getElementById("theme-toggle");
if (btn) btn.addEventListener("click", toggle);
});
})();