diff --git a/src/lib/components/themes/ThemeBackground.svelte b/src/lib/components/themes/ThemeBackground.svelte index 4353fea..6a626e4 100644 --- a/src/lib/components/themes/ThemeBackground.svelte +++ b/src/lib/components/themes/ThemeBackground.svelte @@ -1,15 +1,13 @@ {#if theme.pattern !== 'none'} {#if showTop} - + {/if} {#if showBottom} - + {/if} {/if} diff --git a/src/lib/components/themes/ThemeCard.svelte b/src/lib/components/themes/ThemeCard.svelte index ca09aa3..bb0164c 100644 --- a/src/lib/components/themes/ThemeCard.svelte +++ b/src/lib/components/themes/ThemeCard.svelte @@ -1,8 +1,6 @@ {#if theme.pattern !== 'none'} - + {/if} diff --git a/src/lib/components/themes/svgs/BottomPattern.svelte b/src/lib/components/themes/svgs/BottomPattern.svelte index 1e696d7..3459dd3 100644 --- a/src/lib/components/themes/svgs/BottomPattern.svelte +++ b/src/lib/components/themes/svgs/BottomPattern.svelte @@ -1,38 +1,32 @@ -
- {#if pattern === 'waves'} - - - - {:else if pattern === 'geometric'} - - - - {:else if pattern === 'dots'} - - - - - - - - - {/if} -
+{#if pattern !== 'none'} +
+{/if} diff --git a/src/lib/components/themes/svgs/CardPattern.svelte b/src/lib/components/themes/svgs/CardPattern.svelte index 1ee075e..52dc17c 100644 --- a/src/lib/components/themes/svgs/CardPattern.svelte +++ b/src/lib/components/themes/svgs/CardPattern.svelte @@ -1,14 +1,33 @@ -
- card svg background pattern -
+{#if pattern !== 'none'} +
+{/if} diff --git a/src/lib/components/themes/svgs/TopPattern.svelte b/src/lib/components/themes/svgs/TopPattern.svelte index 543702b..87524a2 100644 --- a/src/lib/components/themes/svgs/TopPattern.svelte +++ b/src/lib/components/themes/svgs/TopPattern.svelte @@ -1,45 +1,32 @@ -
- {@html svgContent} -
+{#if pattern !== 'none'} +
+{/if} diff --git a/src/lib/stores/theme.svelte.ts b/src/lib/stores/theme.svelte.ts index 9a6da49..f5d14ef 100644 --- a/src/lib/stores/theme.svelte.ts +++ b/src/lib/stores/theme.svelte.ts @@ -12,10 +12,8 @@ class ThemeStore { this.current = stored || 'system'; this.applyTheme(); - // Listen for system theme changes const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)'); mediaQuery.addEventListener('change', () => { - // Re-apply theme if in system mode if (this.current === 'system') { this.applyTheme(); } @@ -37,6 +35,8 @@ class ThemeStore { } getResolvedTheme(): ResolvedTheme { + if (!browser) return 'light'; + const isDark = this.current === 'dark' || (this.current === 'system' && window.matchMedia('(prefers-color-scheme: dark)').matches); return isDark ? 'dark' : 'light'; diff --git a/src/lib/utils/themes.ts b/src/lib/utils/themes.ts index 49af6ca..f938f41 100644 --- a/src/lib/utils/themes.ts +++ b/src/lib/utils/themes.ts @@ -1,6 +1,4 @@ -/** - * Theme configuration for SVG overlays - */ +import { themeStore } from '$lib/stores/theme.svelte'; export type ThemePattern = 'waves' | 'geometric' | 'dots' | 'none'; @@ -12,23 +10,24 @@ export interface Theme { export const AVAILABLE_THEMES: Record = { none: { name: 'None', - pattern: 'none', + pattern: 'none' }, waves: { name: 'Waves', - pattern: 'waves', + pattern: 'waves' }, geometric: { name: 'Geometric', - pattern: 'geometric', + pattern: 'geometric' }, dots: { name: 'Dots', - pattern: 'dots', + pattern: 'dots' } }; export const DEFAULT_THEME = 'none'; +export const PATTERN_OPACITY = 0.1; export function getTheme(themeName?: string | null): Theme { if (!themeName || !AVAILABLE_THEMES[themeName]) { @@ -36,3 +35,7 @@ export function getTheme(themeName?: string | null): Theme { } return AVAILABLE_THEMES[themeName]; } + +export function getPatternColor(customColor?: string): string { + return customColor || (themeStore.getResolvedTheme() === 'dark' ? '#FFFFFF' : '#000000'); +} diff --git a/static/themes/dots/bgbottom.svg b/static/themes/dots/bgbottom.svg new file mode 100644 index 0000000..455daf8 --- /dev/null +++ b/static/themes/dots/bgbottom.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/themes/dots/bgtop.svg b/static/themes/dots/bgtop.svg new file mode 100644 index 0000000..455daf8 --- /dev/null +++ b/static/themes/dots/bgtop.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/themes/waves/bgbottom.svg b/static/themes/waves/bgbottom.svg new file mode 100644 index 0000000..455daf8 --- /dev/null +++ b/static/themes/waves/bgbottom.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/themes/waves/bgtop.svg b/static/themes/waves/bgtop.svg new file mode 100644 index 0000000..455daf8 --- /dev/null +++ b/static/themes/waves/bgtop.svg @@ -0,0 +1 @@ + \ No newline at end of file