~james/core

core/web/src/lib/components/settings/ThemeChip.svelte -rw-r--r-- 668 bytes
452f17b7 — james chore(import): snapshot james.dad.town/core at f70c71c7696a 15 hours ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<script lang="ts">
	import { MediaQuery } from "svelte/reactivity";
	import { themeSwatch, type Theme } from "#lib/theme.ts";

	interface Props {
		theme: Theme;
	}

	let { theme }: Props = $props();

	const systemDark = new MediaQuery("(prefers-color-scheme: dark)");

	const swatch = $derived(themeSwatch(theme, systemDark.current));
</script>

<span
	class="inline-flex h-4.5 shrink-0 items-center gap-0.75 rounded-sm px-1 text-[0.625rem] leading-none font-medium edge-ring"
	style="background-color: {swatch.background}; color: {swatch.text}"
	aria-hidden="true"
>
	Aa
	<span class="size-1.5 rounded-full" style="background-color: {swatch.accent}"></span>
</span>