aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/+layout.svelte
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-09-09 15:15:24 -0700
committerAdam Soltys <[email protected]>2025-09-10 10:47:06 -0700
commit9bc38ec4d9f75bcbfa111ed7bf5c9d810b62b86d (patch)
tree63c903573f1f7febdd6b620ecf66e1292fead094 /src/routes/+layout.svelte
parent4e9c0076bc761506ad6fbf7efee5ba9d00ed8c75 (diff)
downloadcoinos-ui-9bc38ec4d9f75bcbfa111ed7bf5c9d810b62b86d.tar.gz
coinos-ui-9bc38ec4d9f75bcbfa111ed7bf5c9d810b62b86d.zip
dark mode fix
Diffstat (limited to 'src/routes/+layout.svelte')
-rw-r--r--src/routes/+layout.svelte14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index 8ae31608..7653e05a 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -7,13 +7,21 @@
import { onMount } from "svelte";
import { installPrompt, theme as themeStore } from "$lib/store";
+
+const map = { light: 'lofi', dark: 'black', system: 'system' };
+
let { data, children } = $props();
let { pathname, theme } = $state(data);
$effect(() => ($themeStore = data.theme));
$effect(() => (theme = $themeStore));
- $effect(() => {
- document.documentElement.setAttribute("data-theme", theme);
- });
+$effect(() => {
+ const v = map[theme] ?? theme;
+ if (!v || v === 'system') {
+ document.documentElement.removeAttribute('data-theme');
+ } else {
+ document.documentElement.setAttribute('data-theme', v);
+ }
+});
let host = PUBLIC_DOMAIN.includes("localhost")
? `http://${PUBLIC_DOMAIN}`