Skip to content

Commit

Permalink
Detect changes to system theme on first load
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastinez committed Nov 26, 2024
1 parent 691e025 commit f19ecf0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit f19ecf0

Please sign in to comment.