mirror of
https://github.com/GenShibe/website.git
synced 2025-02-12 17:04:52 +00:00
hopefully this adds dynamic theming lol
This commit is contained in:
parent
cedecf622b
commit
2c97ec7272
1 changed files with 10 additions and 0 deletions
10
index.html
10
index.html
|
@ -74,6 +74,16 @@
|
||||||
});
|
});
|
||||||
document.querySelector(".last-updated").innerHTML =
|
document.querySelector(".last-updated").innerHTML =
|
||||||
document.lastModified;
|
document.lastModified;
|
||||||
|
|
||||||
|
window.addEventListener("DOMContentLoaded", () => {
|
||||||
|
const selector = document.querySelector(".theme-selector");
|
||||||
|
selector.value = localStorage.getItem("theme") || window.matchMedia('(prefers-color-scheme: light)').matches ? "latte" : "frappe";
|
||||||
|
document.documentElement.setAttribute("theme", selector.value);
|
||||||
|
selector.addEventListener("change", function () {
|
||||||
|
localStorage.setItem("theme", this.value);
|
||||||
|
document.documentElement.setAttribute("theme", this.value);
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Add table
Reference in a new issue