dark mode. this works ok. not too good but yeah it does.
This commit is contained in:
11
js/shared/theme.js
Normal file
11
js/shared/theme.js
Normal file
@@ -0,0 +1,11 @@
|
||||
function toggleDarkMode() {
|
||||
document.body.classList.toggle("dark-mode");
|
||||
localStorage.setItem("dark-mode", document.body.classList.contains("dark-mode"));
|
||||
}
|
||||
|
||||
// Apply stored preference when the page loads
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
if (localStorage.getItem("dark-mode") === "true") {
|
||||
document.body.classList.add("dark-mode");
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user