commit
2dd362e858
11 files changed
+488
-101
No files matched your search
@@ -0,0 +1,87 @@
|
||||
import type { SiteDesign } from '../state/SiteDesignContext';
|
||||
|
||||
/** Colour keys a palette sets. Fonts are optional and applied only when present. */
|
||||
export type PaletteColors = Pick<
|
||||
SiteDesign,
|
||||
| 'primaryColor'
|
||||
| 'secondaryColor'
|
||||
| 'accentColor'
|
||||
| 'linkColor'
|
||||
| 'backgroundColor'
|
||||
| 'textColor'
|
||||
| 'mutedTextColor'
|
||||
| 'borderColor'
|
||||
>;
|
||||
|
||||
export interface Palette {
|
||||
id: string;
|
||||
name: string;
|
||||
design: PaletteColors;
|
||||
fonts?: { headingFont: string; bodyFont: string };
|
||||
}
|
||||
|
||||
/** One-click site palettes ("Try a palette" in Site Design; reused by #58). */
|
||||
export const PALETTES: Palette[] = [
|
||||
{
|
||||
id: 'ocean',
|
||||
name: 'Ocean',
|
||||
design: {
|
||||
primaryColor: '#0e7490', secondaryColor: '#1e40af', accentColor: '#f59e0b', linkColor: '#0e7490',
|
||||
backgroundColor: '#ffffff', textColor: '#0f172a', mutedTextColor: '#475569', borderColor: '#cbd5e1',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'forest',
|
||||
name: 'Forest',
|
||||
design: {
|
||||
primaryColor: '#166534', secondaryColor: '#854d0e', accentColor: '#ca8a04', linkColor: '#166534',
|
||||
backgroundColor: '#fafaf5', textColor: '#1c2b1f', mutedTextColor: '#52614f', borderColor: '#d4dccb',
|
||||
},
|
||||
fonts: { headingFont: 'Merriweather, serif', bodyFont: 'Open Sans, sans-serif' },
|
||||
},
|
||||
{
|
||||
id: 'sunset',
|
||||
name: 'Sunset',
|
||||
design: {
|
||||
primaryColor: '#ea580c', secondaryColor: '#be123c', accentColor: '#7c3aed', linkColor: '#c2410c',
|
||||
backgroundColor: '#fffaf5', textColor: '#2a1a12', mutedTextColor: '#78594a', borderColor: '#f3d9c7',
|
||||
},
|
||||
fonts: { headingFont: 'Poppins, sans-serif', bodyFont: 'Inter, sans-serif' },
|
||||
},
|
||||
{
|
||||
id: 'slate',
|
||||
name: 'Slate',
|
||||
design: {
|
||||
primaryColor: '#334155', secondaryColor: '#64748b', accentColor: '#0ea5e9', linkColor: '#0369a1',
|
||||
backgroundColor: '#ffffff', textColor: '#0f172a', mutedTextColor: '#64748b', borderColor: '#e2e8f0',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'berry',
|
||||
name: 'Berry',
|
||||
design: {
|
||||
primaryColor: '#9d174d', secondaryColor: '#6d28d9', accentColor: '#0d9488', linkColor: '#9d174d',
|
||||
backgroundColor: '#fff8fb', textColor: '#2b1020', mutedTextColor: '#7a5468', borderColor: '#f0d5e1',
|
||||
},
|
||||
fonts: { headingFont: 'Playfair Display, serif', bodyFont: 'Inter, sans-serif' },
|
||||
},
|
||||
{
|
||||
id: 'sand',
|
||||
name: 'Sand',
|
||||
design: {
|
||||
primaryColor: '#a16207', secondaryColor: '#57534e', accentColor: '#0f766e', linkColor: '#92400e',
|
||||
backgroundColor: '#faf7f0', textColor: '#292524', mutedTextColor: '#78716c', borderColor: '#e7e0d0',
|
||||
},
|
||||
fonts: { headingFont: 'Playfair Display, serif', bodyFont: 'Open Sans, sans-serif' },
|
||||
},
|
||||
];
|
||||
|
||||
/** The design patch a palette applies: colours always, fonts only when the palette defines them. */
|
||||
export function paletteUpdates(p: Palette): Partial<SiteDesign> {
|
||||
return { ...p.design, ...(p.fonts ?? {}) };
|
||||
}
|
||||
|
||||
/** True when every colour of `p` equals the design's (used to mark the active preview). */
|
||||
export function paletteMatches(p: Palette, design: SiteDesign): boolean {
|
||||
return (Object.keys(p.design) as (keyof PaletteColors)[]).every((k) => design[k] === p.design[k]);
|
||||
}
|
||||
Reference in new issue
Block a user