# I built an API that stops AI hallucinating colour

> Source: <https://colourmemory.com/start>
> Published: 2026-06-03 14:24:42+00:00

Colour intelligence for agents and design systems.

Maps hex values, palettes, and images to named archive colours. Returns CIEDE2000 distance, Lab/LCh metrics, WCAG contrast, cultural risk, provenance, and design tokens. No signup to try it.

→ Public rate-limited demo key — safe to use in client examples

Architecture

1Archive layerStructured colour records with names, primary sources, notes, and hex values drawn from historical and cultural archives.

3Agent layer65 REST endpoints and MCP tools for LLMs, design systems, and automated workflows.

4Narrative layerOptional LLM-generated reports, hooks, and briefs — clearly labelled where used.

1

Authentication

Your demo key

No signup. The demo key is rate-limited to 50 calls but covers everything below. Get a production key at colourmemory.com when you're ready to build.

API Key

```
cm_demo_public_quickstart
```

Pass as header: X-Api-Key: cm_demo_public_quickstart · Public, rate-limited, safe to expose in client examples.

2

Tool 1 of 3

query.hex

Match any hex to the archive. Returns the nearest named colour with its primary source, confidence score, claim_role, and do_not_say guardrails. This is the core of what Colour Memory does.

curl

```
curl -X POST https://api.colourmemory.com/query/hex \
  -H "X-Api-Key: cm_demo_public_quickstart" \
  -H "Content-Type: application/json" \
  -d '{"hex": "#D4A829", "n_results": 1}'
```

Response — key fields

nameSong Gold Sycee

archiveChina

primary_sourceNorthern Song Dynasty monetary records, 960–1127

confidence0.92

claim_strengthA — Direct institutional record

claim_roleanchor

do_not_say

Do not describe this hex as spectrophotometrically measured — values are computed from material descriptions.

claim_role tells you how hard you can push this entry: anchor = load-bearing evidence. reject = stub, exclude from deliverables.

3

Tool 2 of 3

archive.search

Full-text keyword search across thousands of archive colours. This is a text search, not a colour search — search for "arterial blood" not "red". Use query.hex for hue-based retrieval.

curl

```
curl -X POST https://api.colourmemory.com/archive/search \
  -H "X-Api-Key: cm_demo_public_quickstart" \
  -H "Content-Type: application/json" \
  -d '{"query": "arterial blood", "archive": "Keats", "include_full": true}'
```

Response

nameKeats's Lung

slugkeats:keats-s-lung

hex#C8B6B0

primary_sourceThe Letters, 3 February 1820

claim_roleanchor

Always save the slug from search results. Pass it to colour.card for reliable retrieval — slugs never break on apostrophes.

4

Tool 3 of 3 · Commercial palette analysis

brand.audit

Pass a palette of hex values. Returns WCAG accessibility matrix, cultural risk notes by market, archive matches with provenance, palette role assignments, and a commercial verdict. Fully deterministic — no LLM involved.

curl

```
curl -X POST https://api.colourmemory.com/brand/audit \
  -H "X-Api-Key: cm_demo_public_quickstart" \
  -H "Content-Type: application/json" \
  -d '{
    "palette": ["#D4A829", "#1A5C6E", "#0F2D6B", "#0A0A0B"],
    "markets": ["UK", "China", "Middle East"],
    "context": "luxury packaging"
  }'
```

Response — key fields

wcag_matrixAll foreground/background combinations with AA/AAA pass/fail

cultural_riskPer-market flags with context notes

commercial_labelArchive-verified name for each hex

verdict_copyPlain-English palette verdict

issuesActionable flags requiring attention

5

Optional · No code required

Connect to Claude or ChatGPT

All tools load instantly via MCP. No SDK. No boilerplate. One URL. Disconnect and reconnect after any update to refresh the tool list.

✗Searching for colour by hue with archive.search. Use query.hex or query.conceptual instead. archive.search is text matching, not perceptual matching.

✗Ignoring claim_role. Anything marked reject is a stub with no primary source. Don't use it in client-facing work.

✗Using names instead of slugs. Get the slug from archive.search. Names break on apostrophes. Slugs always work.

✗Presenting a RacingSilks entry as Georgian evidence. Run cultural.anachronism first. A 2011 Jockey Club registration is not Georgian provenance.

✗Ignoring do_not_say fields. They exist to stop your agent making claims the archive doesn't support. Read them.

?

Transparency

What runs without an LLM?

Most core endpoints are fully deterministic. Some endpoints optionally call an LLM for written output, and those are labelled clearly in the docs.

Deterministic (no LLM)

Nearest-colour matching (CIEDE2000)

Lab / LCh metrics and LRV

WCAG contrast and accessibility matrix

Palette role assignment

Cultural risk scoring

Archive audit and coverage gap

Image palette extraction

Design token export

Uses LLM (opt-in)

Brand reports and editorial briefs

session.brief forensic narrative

colour.hooks and colour.story

agent.brief for image generation

↯

Honest caveats

Limitations

·Hex values are computational approximations derived from material descriptions and historical references, not spectrophotometric measurements.

·A nearest archive match means perceptual similarity by CIEDE2000, not historical identity. Song Gold Sycee is the closest named colour — not proof the specific hex existed in 960 AD.

·Cultural risk is context-dependent and should not be treated as universal truth. Market flags are starting points for research, not final verdicts.

·Image extraction uses dominant pixel clustering. It does not yet reliably separate logo, text, product material, and background colours.

·Some endpoints generate editorial copy using an LLM. These are labelled in the docs. The underlying archive data is the same either way.
