wip: making themes more dynamic and easy to add

This commit is contained in:
rasmusq
2025-11-30 01:30:43 +01:00
parent d165e5992a
commit 152bd7cdb1
12 changed files with 76 additions and 98 deletions

View File

@@ -1,37 +1,38 @@
<script lang="ts">
import TopPattern from './svgs/TopPattern.svelte';
import BottomPattern from './svgs/BottomPattern.svelte';
import { getTheme, getThemeColor } from '$lib/utils/themes';
import { getTheme } from '$lib/utils/themes';
const patternOpacity = 0.1;
let {
themeName,
color,
showTop = true,
showBottom = true
showBottom = true,
color = "#FFFFFF"
}: {
themeName?: string | null;
color?: string | null;
showTop?: boolean;
showBottom?: boolean;
color?: string;
} = $props();
const theme = $derived(getTheme(themeName));
const themeColor = $derived(getThemeColor(color));
</script>
{#if theme.pattern !== 'none'}
{#if showTop}
<TopPattern
pattern={theme.pattern}
color={themeColor}
opacity={theme.opacity}
color={color}
opacity={patternOpacity}
/>
{/if}
{#if showBottom}
<BottomPattern
pattern={theme.pattern}
color={themeColor}
opacity={theme.opacity}
color={color}
opacity={patternOpacity}
/>
{/if}
{/if}