cleanup: switch to $state for themes

This commit is contained in:
James Xylight committed 2025-02-10 17:34:40 -08:00
1 parent a5ba6d66f6
commit 80df5c5409
19 files changed
+169 -349

No files matched your search

+8 -13
View File
@@ -6,13 +6,7 @@
import 'nprogress/nprogress.css'
import Moderation from '$lib/components/lemmy/moderation/Moderation.svelte'
import Sidebar from '$lib/components/ui/sidebar/Sidebar.svelte'
import {
colorScheme,
inDarkColorScheme,
rgbToHex,
theme,
themeVars,
} from '$lib/ui/colors.js'
import { inDarkColorScheme, rgbToHex, theme } from '$lib/ui/colors.svelte.js'
import { settings } from '$lib/settings.svelte.js'
import {
Button,
@@ -55,9 +49,6 @@
)
}
document.body.querySelector('.loader')?.classList.add('hidden')
themeVars.subscribe((vars) => {
document.body.setAttribute('style', vars)
})
}
})
@@ -82,6 +73,10 @@
)
}
})
$effect(() => {
document.body.setAttribute('style', theme.vars)
})
}
$effect(() => {
@@ -96,9 +91,9 @@
<meta
name="theme-color"
content={rgbToHex(
$colorScheme && inDarkColorScheme()
? ($theme.colors.zinc?.[925] ?? getDefaultColors().zinc[925])
: ($theme.colors.slate?.[25] ?? getDefaultColors().slate[25]),
theme.colorScheme && inDarkColorScheme()
? (theme.current.colors.zinc?.[925] ?? getDefaultColors().zinc[925])
: (theme.current.colors.slate?.[25] ?? getDefaultColors().slate[25]),
)}
/>
{#if LINKED_INSTANCE_URL}