feat: add basic theming support

This commit is contained in:
Xylight committed 2024-03-04 17:48:09 -08:00
1 parent 2d991fc4a2
commit 81ac6accf4
7 files changed
+299 -72

No files matched your search

+1 -27
View File
@@ -10,41 +10,15 @@
import Logo from '$lib/components/ui/Logo.svelte'
import { LINKED_INSTANCE_URL, instance } from '$lib/instance.js'
import { site } from '$lib/lemmy.js'
import { userSettings } from '$lib/settings.js'
import { theme } from '$lib/ui/colors.js'
import { Menu, MenuButton, MenuDivider, Spinner } from 'mono-svelte'
import {
Badge,
Button,
Menu,
MenuButton,
MenuDivider,
Select,
Spinner,
toast,
} from 'mono-svelte'
import {
Bars3,
Bookmark,
BugAnt,
CodeBracket,
CodeBracketSquare,
Cog6Tooth,
CommandLine,
ComputerDesktop,
GlobeAlt,
Heart,
Icon,
Inbox,
InformationCircle,
MagnifyingGlass,
Moon,
Newspaper,
PencilSquare,
Plus,
ServerStack,
Sun,
UserCircle,
UserGroup,
} from 'svelte-hero-icons'
import { fly } from 'svelte/transition'
import Profile from './Profile.svelte'
+14 -11
View File
@@ -27,8 +27,9 @@
UserCircle,
UserGroup,
} from 'svelte-hero-icons'
import { theme } from '$lib/ui/colors'
import { legacyTheme } from '$lib/ui/colors'
import { userSettings } from '$lib/settings'
import { goto } from '$app/navigation'
</script>
<Menu {...$$restProps}>
@@ -97,26 +98,28 @@
<Icon src={Cog6Tooth} mini width={16} />
Settings
</MenuButton>
<MenuButton class="!py-0">
<MenuButton
class="!py-0"
on:click={() => {
goto('/theme')
}}
>
<Icon
src={$theme == 'system'
src={$legacyTheme == 'system'
? ComputerDesktop
: $theme == 'light'
: $legacyTheme == 'light'
? Sun
: $theme == 'dark'
: $legacyTheme == 'dark'
? Moon
: Moon}
mini
size="16"
/>
<span>Color Scheme</span>
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div
class="flex flex-row flex-wrap justify-between w-full items-center"
on:click|stopPropagation
>
<span>Theme</span>
<Select bind:value={$theme} class="ml-auto my-auto w-24" size="sm">
<div class="contents" on:click|stopPropagation={() => {}}>
<Select bind:value={$legacyTheme} class="ml-auto my-auto w-24" size="sm">
<option value="system">System</option>
<option value="light">Light</option>
<option value="dark">Dark</option>