feat(webui): add Catppuccin Latte/Frappé/Macchiato/Mocha palettes
Add a "配色方案" picker offering the four Catppuccin flavors as full color schemes alongside the default sky theme. - Schema: new `palette` field on UiAppearance (core + client mirror), normalized to a 5-value whitelist defaulting to 'default'. - Apply: each flavor's base/surface tokens are injected into the shared theme stylesheet over :root (Latte) or .dark (the three dark flavors); accent (--primary/--ring) stays separate so it composes. A flavor fixes light/dark (Latte→light, rest→dark), overriding `mode`, and forces dark-intensity to soft so the OLED "black" rule can't fight the palette. sidebar-style + high-contrast still compose (higher specificity). - Pre-paint bootstrap is palette-aware (no light↔dark flash on reload). - Settings: swatch-preview picker; mode + dark-intensity controls disable while a flavor is active. The top-bar ThemeToggle hides then (it would be inert under a fixed-scheme palette).
This commit is contained in:
6 files changed
+191
-20
No files matched your search
@@ -43,6 +43,9 @@ export type SidebarStyle = 'follow' | 'panel' | 'accent';
|
||||
export type BackgroundType = 'none' | 'solid' | 'gradient' | 'image';
|
||||
export type Density = 'cozy' | 'compact';
|
||||
export type TimeFormat = '12h' | '24h';
|
||||
/** Full color scheme. 'default' keeps the sky theme (driven by `mode`); the
|
||||
* Catppuccin flavors are complete palettes that also fix light/dark. */
|
||||
export type Palette = 'default' | 'catppuccin-latte' | 'catppuccin-frappe' | 'catppuccin-macchiato' | 'catppuccin-mocha';
|
||||
|
||||
export interface UiBackground {
|
||||
type: BackgroundType;
|
||||
@@ -70,6 +73,8 @@ export interface UiAppearance {
|
||||
accentCustom: string;
|
||||
accentScope: AccentScope;
|
||||
darkIntensity: DarkIntensity;
|
||||
/** Full color scheme; 'default' = the built-in sky theme. */
|
||||
palette: Palette;
|
||||
sidebarStyle: SidebarStyle;
|
||||
background: UiBackground;
|
||||
/** Sans font preset id (frontend catalogue). */
|
||||
@@ -179,6 +184,7 @@ const DEFAULT_APPEARANCE: UiAppearance = {
|
||||
accentCustom: '#38bdf8',
|
||||
accentScope: 'global',
|
||||
darkIntensity: 'soft',
|
||||
palette: 'default',
|
||||
sidebarStyle: 'follow',
|
||||
background: DEFAULT_BACKGROUND,
|
||||
fontSans: 'default',
|
||||
@@ -385,6 +391,7 @@ export function normalizeAppearance(value: unknown, imageState: ServerImageState
|
||||
accentCustom: hexOr(v.accentCustom, DEFAULT_APPEARANCE.accentCustom),
|
||||
accentScope: oneOf<AccentScope>(v.accentScope, ['sidebar', 'global'], DEFAULT_APPEARANCE.accentScope),
|
||||
darkIntensity: oneOf<DarkIntensity>(v.darkIntensity, ['soft', 'black'], DEFAULT_APPEARANCE.darkIntensity),
|
||||
palette: oneOf<Palette>(v.palette, ['default', 'catppuccin-latte', 'catppuccin-frappe', 'catppuccin-macchiato', 'catppuccin-mocha'], DEFAULT_APPEARANCE.palette),
|
||||
sidebarStyle: oneOf<SidebarStyle>(v.sidebarStyle, ['follow', 'panel', 'accent'], DEFAULT_APPEARANCE.sidebarStyle),
|
||||
background: normalizeBackground(v.background, imageState),
|
||||
fontSans: idOr(v.fontSans, DEFAULT_APPEARANCE.fontSans),
|
||||
|
||||
Reference in new issue
Block a user