mirror of
https://github.com/GenShibe/website.git
synced 2025-02-12 13:44:49 +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.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>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Add table
Reference in a new issue