mirror of
https://github.com/ShaYmez/FreeSTAR-Status-Engine.git
synced 2025-04-17 16:58:55 -04:00
add darkmode detection
This commit is contained in:
parent
6cecff3cc3
commit
313c8b1db0
@ -53,3 +53,10 @@ function resetTheme() {
|
||||
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…
Reference in New Issue
Block a user