add event listener to hot reload theme

This commit is contained in:
Jappie3
2024-11-25 16:49:50 +01:00
committed by Sebastian Martinez
parent b050924caa
commit 032b269cb9
+7
View File
@@ -24,6 +24,13 @@
const activeRouteStore = router.activeRouteStore;
window
.matchMedia("(prefers-color-scheme: dark)")
.addEventListener("change", ({ matches }) => {
theme.set(matches ? "dark" : "light");
followSystemTheme.set(true);
});
void router.loadFromLocation();
$: document.documentElement.setAttribute("data-codefont", $codeFont);