diff options
| author | Fuwn <[email protected]> | 2023-09-03 22:56:00 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-09-03 22:56:00 -0700 |
| commit | cf18f1986ab373989b92245f2b15ce933a2a3662 (patch) | |
| tree | 44be1ea5e3a7341300ec331715e09e1ff1eed64c /src/routes/+layout.svelte | |
| parent | revert: "feat(html): local css" (diff) | |
| download | due.moe-cf18f1986ab373989b92245f2b15ce933a2a3662.tar.xz due.moe-cf18f1986ab373989b92245f2b15ce933a2a3662.zip | |
feat: dark theme
Diffstat (limited to 'src/routes/+layout.svelte')
| -rw-r--r-- | src/routes/+layout.svelte | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 07c5435a..a11ea3ee 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -4,6 +4,7 @@ import { onMount } from 'svelte'; import { lastActivityDate } from '$lib/AniList/activity'; import userIdentity from '../stores/userIdentity'; + import settings from '../stores/settings'; export let data; @@ -11,6 +12,14 @@ let lastActivityWasToday = true; onMount(async () => { + settings.subscribe((value) => { + if (value.forceLightTheme === true) { + document.documentElement.classList.add('light-theme'); + } else { + document.documentElement.classList.remove('light-theme'); + } + }); + if (data.user !== undefined) { if ($userIdentity === '') { userIdentity.set(JSON.stringify(await getUserIdentity(data.user))); @@ -48,3 +57,13 @@ <hr /> <slot /> + +<style> + :global(html.light-theme) { + filter: invert(0); + } + + :global(html.light-theme img) { + filter: invert(0); + } +</style> |