mirror of
https://github.com/ShaYmez/FreeSTAR-Status-Engine.git
synced 2025-06-25 05:25:32 -04:00
add darkmode detection
This commit is contained in:
parent
6cecff3cc3
commit
313c8b1db0
@ -53,3 +53,10 @@ function resetTheme() {
|
|||||||
localStorage.removeItem("darkSwitch");
|
localStorage.removeItem("darkSwitch");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) {
|
||||||
|
document.body.setAttribute("data-theme", "dark");
|
||||||
|
}
|
||||||
|
window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", (e) => {
|
||||||
|
const newColorScheme = e.matches ? document.body.setAttribute("data-theme", "dark") : document.body.removeAttribute("data-theme");
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user