summaryrefslogtreecommitdiff
path: root/src/ts/script.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/ts/script.ts')
-rw-r--r--src/ts/script.ts3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ts/script.ts b/src/ts/script.ts
index 8aff107..6f0b0c1 100644
--- a/src/ts/script.ts
+++ b/src/ts/script.ts
@@ -52,10 +52,11 @@ function getStoredTheme(): Theme | null {
function initThemeToggle(): void {
const toggleButton = document.getElementById('theme-toggle');
- if (!(toggleButton instanceof HTMLInputElement)) return;
const initialTheme = getStoredTheme() ?? getSystemTheme();
applyTheme(initialTheme);
+
+ if (!(toggleButton instanceof HTMLInputElement)) return;
toggleButton.checked = initialTheme === 'dark';
toggleButton.addEventListener('change', () => {