feat: remake theme handling
This commit is contained in:
1 parent
18d2e8fc1e
commit
3aa948891a
10 files changed
+413
-249
No files matched your search
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import { Color } from '$lib/ui/colors'
|
||||
import {
|
||||
ArrowDownCircle,
|
||||
ArrowUp,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
top: boolean | null
|
||||
noGap: boolean | null
|
||||
},
|
||||
screenWidth: number,
|
||||
screenWidth: number
|
||||
): {
|
||||
noGap: boolean
|
||||
top: boolean
|
||||
@@ -35,7 +35,7 @@
|
||||
export const calculatePadding = (
|
||||
panel: boolean,
|
||||
top: boolean,
|
||||
content: boolean,
|
||||
content: boolean
|
||||
): {
|
||||
top: number
|
||||
class: string
|
||||
@@ -62,13 +62,13 @@
|
||||
})
|
||||
export let contentPadding: Readable<ReturnType<typeof calculatePadding>> =
|
||||
derived(dockProps, ($dockProps, set) =>
|
||||
set(calculatePadding($dockProps.noGap, $dockProps.top, true)),
|
||||
set(calculatePadding($dockProps.noGap, $dockProps.top, true))
|
||||
)
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import { colors, colorsToVars } from '$lib/ui/colors'
|
||||
import { themeVars } from '$lib/ui/colors'
|
||||
import { routes } from '$lib/util.js'
|
||||
import { derived, writable, type Readable, type Writable } from 'svelte/store'
|
||||
|
||||
@@ -82,11 +82,7 @@
|
||||
|
||||
<svelte:window bind:innerWidth={$screenWidth} />
|
||||
|
||||
<div
|
||||
{...$$restProps}
|
||||
class="shell {$$props.class}"
|
||||
style={colorsToVars($colors)}
|
||||
>
|
||||
<div {...$$restProps} class="shell {$$props.class}" style={$themeVars}>
|
||||
<slot />
|
||||
<div
|
||||
class="
|
||||
@@ -112,7 +108,7 @@
|
||||
pointer-events-auto {topPanel
|
||||
? 'bg-slate-50 dark:bg-zinc-950 border-slate-100 dark:border-zinc-900'
|
||||
: `border-slate-200 dark:border-zinc-800 shadow-2xl backdrop-blur-xl
|
||||
dark:backdrop-brightness-[25%] bg-[#ffffff]/75`}"
|
||||
bg-white/50 dark:bg-zinc-925/70`}"
|
||||
{title}
|
||||
style="transition: border-radius 250ms;"
|
||||
/>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
UserCircle,
|
||||
UserGroup,
|
||||
} from 'svelte-hero-icons'
|
||||
import { legacyTheme } from '$lib/ui/colors'
|
||||
import { colorScheme } from '$lib/ui/colors'
|
||||
import { userSettings } from '$lib/settings'
|
||||
import { site } from '$lib/lemmy'
|
||||
import SiteCard from '$lib/components/lemmy/SiteCard.svelte'
|
||||
@@ -127,11 +127,11 @@
|
||||
</MenuButton>
|
||||
<MenuButton class="!py-0">
|
||||
<Icon
|
||||
src={$legacyTheme == 'system'
|
||||
src={$colorScheme == 'system'
|
||||
? ComputerDesktop
|
||||
: $legacyTheme == 'light'
|
||||
: $colorScheme == 'light'
|
||||
? Sun
|
||||
: $legacyTheme == 'dark'
|
||||
: $colorScheme == 'dark'
|
||||
? Moon
|
||||
: Moon}
|
||||
mini
|
||||
@@ -142,7 +142,7 @@
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||
<div class="contents" on:click|stopPropagation={() => {}}>
|
||||
<Select bind:value={$legacyTheme} class="ml-auto my-auto w-24" size="sm">
|
||||
<Select bind:value={$colorScheme} class="ml-auto my-auto w-24" size="sm">
|
||||
<option value="system">{$t('nav.menu.colorscheme.system')}</option>
|
||||
<option value="light">{$t('nav.menu.colorscheme.light')}</option>
|
||||
<option value="dark">{$t('nav.menu.colorscheme.dark')}</option>
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
import { resumables, type ResumableItem } from '$lib/lemmy/item'
|
||||
import { userSettings } from '$lib/settings'
|
||||
import { t } from '$lib/translations'
|
||||
import { legacyTheme } from '$lib/ui/colors'
|
||||
import { colorScheme } from '$lib/ui/colors'
|
||||
import { fullCommunityName } from '$lib/util'
|
||||
import {
|
||||
ArrowRightOnRectangle,
|
||||
@@ -354,21 +354,21 @@ export function getGroups(
|
||||
name: t.get('nav.commands.setColorTo', {
|
||||
default: t.get('nav.menu.colorscheme.system'),
|
||||
}),
|
||||
handle: () => legacyTheme.set('system'),
|
||||
handle: () => colorScheme.set('system'),
|
||||
icon: ComputerDesktop,
|
||||
},
|
||||
{
|
||||
name: t.get('nav.commands.setColorTo', {
|
||||
default: t.get('nav.menu.colorscheme.light'),
|
||||
}),
|
||||
handle: () => legacyTheme.set('light'),
|
||||
handle: () => colorScheme.set('light'),
|
||||
icon: Sun,
|
||||
},
|
||||
{
|
||||
name: t.get('nav.commands.setColorTo', {
|
||||
default: t.get('nav.menu.colorscheme.dark'),
|
||||
}),
|
||||
handle: () => legacyTheme.set('dark'),
|
||||
handle: () => colorScheme.set('dark'),
|
||||
icon: Moon,
|
||||
},
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user