Files
wishlist/src/lib/utils/themes.ts

42 lines
886 B
TypeScript

import { themeStore } from '$lib/stores/theme.svelte';
export type ThemePattern = 'waves' | 'geometric' | 'dots' | 'none';
export interface Theme {
name: string;
pattern: ThemePattern;
}
export const AVAILABLE_THEMES: Record<string, Theme> = {
none: {
name: 'None',
pattern: 'none'
},
waves: {
name: 'Waves',
pattern: 'waves'
},
geometric: {
name: 'Geometric',
pattern: 'geometric'
},
dots: {
name: '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]) {
return AVAILABLE_THEMES[DEFAULT_THEME];
}
return AVAILABLE_THEMES[themeName];
}
export function getPatternColor(customColor?: string): string {
return customColor || (themeStore.getResolvedTheme() === 'dark' ? '#FFFFFF' : '#000000');
}