Files
pastel-ui/app/palettes/page.tsx
valknarness c3745bd6b7 feat: implement palette generation features
Add complete palette generation system with multiple methods:

**New Components:**
- ColorSwatch component - Individual color display
  - Click to copy to clipboard
  - Hover effects with copy icon
  - Configurable sizes (sm, md, lg)
  - Optional color label display
  - Check icon on successful copy

- PaletteGrid component - Grid display for color palettes
  - Responsive grid layout (3-6 columns)
  - Click handler for color selection
  - Empty state message
  - Flexible and reusable

- Select component - Dropdown selector
  - Consistent styling with other inputs
  - Optional label support
  - Keyboard accessible
  - Focus ring styling

**Palette Pages:**

1. Gradient Creator (/palettes/gradient)
   - Multiple color stop editor (add/remove)
   - Configurable step count (2-1000)
   - Color space selection (RGB, HSL, Lab, LCH, OkLab, OkLCH)
   - Live gradient preview bar
   - Full palette grid display
   - Interactive color pickers for each stop
   - Real-time generation

2. Distinct Colors (/palettes/distinct)
   - Count selector (2-100 colors)
   - Distance metric selection (CIE76, CIEDE2000)
   - Simulated annealing algorithm
   - Statistics display:
     - Minimum distance
     - Average distance
     - Generation time
   - Loading state with progress message
   - Quality metrics for generated palette

3. Palettes Dashboard (/palettes)
   - Overview of all palette generators
   - Feature cards with icons
   - "Coming Soon" badge for harmony palettes
   - Quick navigation to each generator
   - Feature highlights for each method

**Features:**
- All palette generators integrated with Pastel API
- Toast notifications for success/error
- Loading states during generation
- Copy colors to clipboard
- Responsive layouts
- Empty states
- Error handling

**API Integration:**
- useGenerateGradient mutation
- useGenerateDistinct mutation
- Proper error handling and loading states
- Result caching with React Query

Build successful! 3 new palette pages rendering.

Next: Harmony palettes, accessibility tools, and named colors.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 11:38:20 +01:00

75 lines
2.7 KiB
TypeScript

import Link from 'next/link';
import { Palette, Sparkles, GraduationCap } from 'lucide-react';
export default function PalettesPage() {
const paletteTypes = [
{
title: 'Gradient Creator',
description: 'Create smooth color gradients with multiple stops and color spaces',
href: '/palettes/gradient',
icon: GraduationCap,
features: ['Multiple color stops', 'Various color spaces', 'Live preview'],
},
{
title: 'Distinct Colors',
description: 'Generate visually distinct colors using simulated annealing algorithm',
href: '/palettes/distinct',
icon: Sparkles,
features: ['Perceptual distance', 'Configurable count', 'Quality metrics'],
},
{
title: 'Harmony Palettes',
description: 'Create color palettes based on color theory and harmony rules',
href: '/palettes/harmony',
icon: Palette,
features: ['Color theory', 'Multiple schemes', 'Instant generation'],
comingSoon: true,
},
];
return (
<div className="min-h-screen p-8">
<div className="max-w-7xl mx-auto space-y-8">
<div>
<h1 className="text-4xl font-bold mb-2">Palette Generation</h1>
<p className="text-muted-foreground">
Create beautiful color palettes using various generation methods
</p>
</div>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
{paletteTypes.map((type) => {
const Icon = type.icon;
return (
<Link
key={type.href}
href={type.comingSoon ? '#' : type.href}
className={`p-6 border rounded-lg bg-card hover:border-primary transition-colors ${
type.comingSoon ? 'opacity-60 cursor-not-allowed' : ''
}`}
>
<div className="flex items-start justify-between mb-4">
<Icon className="h-8 w-8 text-primary" />
{type.comingSoon && (
<span className="text-xs bg-muted px-2 py-1 rounded">Coming Soon</span>
)}
</div>
<h2 className="text-xl font-semibold mb-2">{type.title}</h2>
<p className="text-sm text-muted-foreground mb-4">{type.description}</p>
<ul className="space-y-1">
{type.features.map((feature) => (
<li key={feature} className="text-sm text-muted-foreground flex items-center">
<span className="mr-2"></span>
{feature}
</li>
))}
</ul>
</Link>
);
})}
</div>
</div>
</div>
);
}