import { cn } from "@/lib/utils"; /** * Palette role shape emitted by the theme-generation workshop. * Each role carries both a dark and light variant resolved as OKLCH + hex * alongside a WCAG AA pass/fail flag computed against the generated * background. */ export interface PaletteRole { name: string; dark: { oklch: string; hex: string; wcagAA: boolean }; light: { oklch: string; hex: string; wcagAA: boolean }; } interface ThemePaletteGridProps { palette: PaletteRole[]; variant?: "dark" | "light"; className?: string; } const ROLE_LABELS: Record = { background: "Background", surface: "Surface", overlay: "Overlay", text: "Text", "accent-1": "Accent 1", "accent-2": "Accent 2", "accent-3": "Accent 3", }; function Swatch({ role, variant, }: { role: PaletteRole; variant: "dark" | "light"; }) { const entry = variant === "dark" ? role.dark : role.light; const label = ROLE_LABELS[role.name] ?? role.name; return (
{label} {entry.hex} {entry.wcagAA ? "AA" : "Fails AA"}
); } function PaletteRow({ palette, variant, }: { palette: PaletteRole[]; variant: "dark" | "light"; }) { return (
{variant === "dark" ? "Dark mode" : "Light mode"}
{palette.map((role) => ( ))}
); } export function ThemePaletteGrid({ palette, variant, className, }: ThemePaletteGridProps) { if (palette.length === 0) { return (

No palette yet

Pick a seed color to generate a full OKLCH palette with dark and light variants.

); } // When variant is passed explicitly, render only that row. Otherwise show // both dark and light, so reviewers can compare the generated bundle. if (variant) { return (
); } return (
); }