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
@@ -1,6 +1,6 @@
|
||||
import { Monitor, Moon, Sun } from 'lucide-react';
|
||||
import { motion } from 'motion/react';
|
||||
import { useTheme, type ThemeMode } from '@/contexts/ThemeContext';
|
||||
import { paletteResolved, useTheme, type ThemeMode } from '@/contexts/ThemeContext';
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
const OPTIONS: { mode: ThemeMode; icon: typeof Sun; label: string }[] = [
|
||||
@@ -10,7 +10,11 @@ const OPTIONS: { mode: ThemeMode; icon: typeof Sun; label: string }[] = [
|
||||
];
|
||||
|
||||
export function ThemeToggle({ className }: { className?: string }) {
|
||||
const { mode, setMode } = useTheme();
|
||||
const { appearance, mode, setMode } = useTheme();
|
||||
// A Catppuccin flavor fixes light/dark, so this quick toggle would be inert
|
||||
// (and its pill would desync from the forced scheme) — hide it. Light/dark is
|
||||
// then changed by switching the palette back to “默认” in settings.
|
||||
if (paletteResolved(appearance.palette)) return null;
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
|
||||
Reference in new issue
Block a user