Detect changes to system theme on first load

This commit is contained in:
Sebastian Martinez
2024-11-26 09:22:13 +01:00
parent 691e0255fb
commit f19ecf09ed
+11 -1
View File
@@ -2,7 +2,12 @@
import * as router from "@app/lib/router";
import { unreachable } from "@app/lib/utils";
import { codeFont, followSystemTheme, theme } from "@app/lib/appearance";
import {
codeFont,
followSystemTheme,
loadTheme,
theme,
} from "@app/lib/appearance";
import FullscreenModalPortal from "./App/FullscreenModalPortal.svelte";
import Hotkeys from "./App/Hotkeys.svelte";
@@ -32,6 +37,11 @@
}
});
// Detect any change to the system theme on first load.
if ($followSystemTheme) {
theme.set(loadTheme());
}
void router.loadFromLocation();
$: document.documentElement.setAttribute("data-codefont", $codeFont);