How PalettePulse works.
The generator
You post a brand brief to POST /api/generate. When ANTHROPIC_API_KEY is set, the request is forwarded to Claude Sonnet with a design-tuned system prompt. When it isn't, the same request is answered by a deterministic mock so the demo works offline. Both responses share the same JSON shape:
{
"palette": {
"id": "pal_x2f7d1a",
"name": "Luxury system",
"brief": "A luxury watchmaker restoring itself…",
"createdAt": "2026-07-01T14:00:00.000Z",
"source": "prompt",
"swatches": [
{ "role": "background", "hex": "#f5f2ea", "oklch": {...}, "name": "Bone" },
…
]
},
"source": "anthropic" // or "mock" / "fallback"
}Why OKLCH
Every swatch stored as OKLCH triples means you can raise or lower lightness on the same hue without hue-drift. The contrastInk()helper picks black or white for text on any swatch by looking at its OKLCH L — perceptually correct in a way hex-luminance heuristics aren't. All conversions go through culori.
Exports
Three formats out of the box:
- · Tailwind v4 — a ready
@themeblock for globals.css - · CSS variables —
:rootwith both hex and OKLCH pairs - · Design-token JSON — Style Dictionary / Figma Tokens Studio friendly
Rate limits
Anonymous requests are capped at 30 per hour per IP (would be enforced by Vercel KV in the full-fat version). Signed-in accounts get 300 per hour on the free tier.