File size: 23,941 Bytes
1253f23
15cb7d3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1253f23
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Colour Memory — Give AI evidence for colour claims</title>
<meta name="description" content="The evidence layer for colour. 46,000 sourced records, an evidence grade on every one, and the exact claims you must not make.">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap">
<style>
:root{
  --gold:#D4A829; --teal:#1A5C6E; --navy:#24214E; --ink:#0A0A0B;
  --ground:#F8F7F5; --ground2:#EFEDE8; --white:#FFFFFF;
  --border:#E0DCD4; --mid:#4A4E50; --muted:#6B6764; --gold-text:#8A6B12;
  --gA:#1A5C6E; --gB:#2E6B62; --gC:#7A6A45; --gD:#8A5A38; --gE:#9A3B33;
  --sans:Inter,system-ui,-apple-system,"Helvetica Neue",sans-serif;
  --mono:"JetBrains Mono",ui-monospace,Menlo,monospace;
}
*{box-sizing:border-box}
body{margin:0;background:var(--ground);color:var(--ink);font-family:var(--sans);font-size:16px;line-height:1.6;-webkit-font-smoothing:antialiased}
.wrap{max-width:960px;margin:0 auto;padding:0 24px}
.lab{font-family:var(--mono);font-size:10.5px;letter-spacing:.16em;text-transform:uppercase;color:var(--muted)}

nav{border-bottom:1px solid var(--border);background:var(--ground)}
nav .wrap{display:flex;align-items:center;gap:14px;height:58px}
.mark{width:26px;height:26px;flex:none;display:block}
.word{font-family:var(--mono);font-size:11px;letter-spacing:.2em;text-transform:uppercase;font-weight:600;line-height:1.15}
nav .spacer{flex:1}
nav a.navlink{font-family:var(--mono);font-size:10.5px;letter-spacing:.14em;text-transform:uppercase;color:var(--mid);text-decoration:none}
nav a.navlink:hover{color:var(--gold-text)}

.hero{background:var(--ink);color:var(--white);position:relative;overflow:hidden}
.hero .bands{position:absolute;inset:0 auto 0 0;width:32%;display:flex}
.hero .bands div{flex:1}
.hero .inner{position:relative;padding:62px 0 58px;max-width:640px;margin-left:auto}
.hero .tagline{color:var(--gold);font-family:var(--mono);font-size:10.5px;letter-spacing:.18em;text-transform:uppercase;margin-bottom:22px}
.hero h1{font-size:clamp(32px,5.4vw,52px);line-height:1.06;font-weight:700;letter-spacing:-.025em;margin:0 0 20px;text-wrap:balance}
.hero h1 em{font-style:normal;color:var(--gold);display:block}
.hero p{font-size:17px;line-height:1.55;color:#C9C6C1;margin:0;max-width:54ch}
.hero p.answer{font-family:var(--sans);font-size:clamp(20px,2.8vw,26px);font-weight:700;
  color:var(--gold);letter-spacing:-.015em;margin:0 0 14px}
.halt{background:var(--ground2);border-bottom:1px solid var(--border)}
.halt .inner{padding:30px 0 32px;border-left:3px solid var(--gold);padding-left:24px;max-width:640px}
.halt h2{font-family:var(--mono);font-size:10.5px;letter-spacing:.16em;text-transform:uppercase;
  color:var(--gold-text);margin:0 0 14px;font-weight:600}
.halt p{font-size:17px;line-height:1.5;color:var(--mid);margin:0 0 12px;max-width:56ch}
.halt p:last-child{margin-bottom:0}
.halt p.lead{font-size:clamp(19px,2.7vw,23px);font-weight:700;letter-spacing:-.02em;
  color:var(--ink);line-height:1.2}
@media (max-width:760px){.hero .bands{display:none}.hero .inner{margin-left:0;padding:44px 0 40px}}

.ask{padding:32px 0 10px}
form{display:flex;gap:10px;flex-wrap:wrap}
input[type=text]{flex:1 1 260px;min-width:0;font-family:var(--mono);font-size:17px;padding:14px 16px;border:1px solid #CFC9BE;border-radius:2px;background:var(--white);color:var(--ink)}
input[type=text]:focus{outline:2px solid var(--gold);outline-offset:1px;border-color:var(--gold)}
button{font-family:var(--sans);font-size:13px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;padding:14px 24px;border-radius:2px;border:1px solid var(--ink);background:var(--ink);color:var(--white);cursor:pointer}
button:hover{background:var(--gold);border-color:var(--gold);color:var(--ink)}
button:focus-visible{outline:2px solid var(--gold);outline-offset:2px}
.freebie{font-family:var(--mono);font-size:11.5px;color:var(--muted);margin-top:16px;line-height:1.6}
.freebie a{color:var(--gold-text)}
.examples{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin:18px 0 0}
.ex{font-family:var(--mono);font-size:12px;font-weight:400;letter-spacing:0;text-transform:none;padding:7px 12px;background:transparent;color:var(--mid);border:1px solid #CFC9BE}
.ex:hover{background:var(--gold);color:var(--ink);border-color:var(--gold)}
.ex i{font-style:normal;display:inline-block;width:9px;height:9px;border-radius:1px;margin-right:8px;vertical-align:-1px;border:1px solid rgba(10,10,11,.2)}
#status{font-family:var(--mono);font-size:12px;color:var(--muted);margin:20px 0 0;min-height:18px}
.egnote{font-family:var(--mono);font-size:10.5px;letter-spacing:.14em;text-transform:uppercase;
  color:var(--gold-text);background:var(--ground2);border:1px solid var(--border);border-bottom:0;
  padding:9px 18px}
#status.err{color:var(--gE)}

#out{margin:20px 0 0}
.card{background:var(--white);border:1px solid var(--border);margin-bottom:14px}
.card .top{display:flex;align-items:center;gap:15px;padding:16px 18px;border-bottom:1px solid var(--border);flex-wrap:wrap}
.chip{width:42px;height:42px;flex:none;border:1px solid rgba(10,10,11,.14)}
.card .nm{font-size:16.5px;font-weight:600;line-height:1.25}
.card .hx{font-family:var(--mono);font-size:11.5px;color:var(--muted);margin-top:2px}
.card .top .right{margin-left:auto;display:flex;gap:8px;align-items:center;flex-wrap:wrap;justify-content:flex-end}
.g{font-family:var(--mono);font-size:10.5px;font-weight:600;letter-spacing:.09em;padding:4px 9px;border:1px solid currentColor;white-space:nowrap}
.g.A{color:var(--gA)} .g.B{color:var(--gB)} .g.C{color:var(--gC)} .g.D{color:var(--gD)} .g.E{color:var(--gE)}
.de{font-family:var(--mono);font-size:11.5px;color:var(--muted);font-variant-numeric:tabular-nums}
.blk{padding:14px 18px;border-bottom:1px solid var(--border)}
.blk:last-child{border-bottom:0}
.blk .lab{display:block;margin-bottom:8px}
.blk p{margin:0;font-size:14.5px;color:var(--mid);line-height:1.55}
.kv{font-family:var(--mono);font-size:12.5px;color:var(--mid);display:flex;flex-wrap:wrap;gap:4px 22px}
.kv b{color:var(--ink);font-weight:500}
.limits{background:var(--ground2)}
.limits .lab{color:var(--gE)}
.limits ul{margin:0;padding-left:17px}
.limits li{font-size:13.5px;color:var(--mid);margin-bottom:5px}
.limits li:last-child{margin-bottom:0}
details.receipt{border-top:1px solid var(--border)}
details.receipt summary{cursor:pointer;padding:12px 18px;font-family:var(--mono);font-size:10.5px;letter-spacing:.14em;text-transform:uppercase;color:var(--gold-text)}
details.receipt summary:focus-visible{outline:2px solid var(--gold);outline-offset:-2px}
.receipt .body{padding:0 18px 16px;font-family:var(--mono);font-size:12px;line-height:1.8;color:var(--mid);overflow-x:auto}
.receipt .k{color:var(--muted);display:inline-block;min-width:150px}
.receipt .v{color:var(--ink)}

.unlock{margin:44px 0 0;border-top:2px solid var(--ink);padding-top:26px}
.unlock h2{font-size:clamp(21px,3.2vw,28px);font-weight:700;letter-spacing:-.02em;line-height:1.14;margin:0 0 6px}
.unlock .sub{font-size:16px;color:var(--mid);margin:0 0 24px;max-width:62ch}
.only{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:1px;background:var(--border);border:1px solid var(--border)}
.only>div{background:var(--white);padding:20px}
.only .n{font-family:var(--mono);font-size:10.5px;letter-spacing:.15em;color:var(--gold-text);margin-bottom:10px}
.only h3{font-size:16px;font-weight:700;margin:0 0 7px;letter-spacing:-.01em}
.only p{font-size:14px;color:var(--mid);margin:0}
.only .no{margin-top:12px;padding-top:11px;border-top:1px solid var(--border);font-family:var(--mono);font-size:11.5px;color:var(--muted);line-height:1.5}

.proof{background:var(--ink);color:var(--white);margin-top:44px;padding:40px 0}
.proof h2{font-size:clamp(22px,3.4vw,30px);font-weight:700;letter-spacing:-.02em;line-height:1.1;margin:0 0 24px}
.proof h2 em{font-style:normal;color:var(--gold);display:block}
.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:1px;background:#26262A;border:1px solid #26262A;margin-bottom:18px}
.stat{background:var(--ink);padding:18px 20px}
.stat .n{font-family:var(--mono);font-size:26px;font-weight:600;color:var(--gold);line-height:1;margin-bottom:7px}
.stat .l{font-family:var(--mono);font-size:10px;letter-spacing:.15em;text-transform:uppercase;color:#8E8A85}
.proof .fine{font-size:13px;color:#8E8A85;margin:0}

.kicker{margin:44px 0 0;padding:24px 0 0;border-top:2px solid var(--ink)}
.kicker p{font-size:clamp(19px,2.7vw,24px);font-weight:700;letter-spacing:-.02em;line-height:1.22;
  margin:0;max-width:34ch}
.routes{display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:1px;background:var(--border);border:1px solid var(--border);margin:38px 0 0}
.route{background:var(--white);padding:22px 20px;display:flex;flex-direction:column}
.route .lab{margin-bottom:9px}
.route h3{font-size:17px;font-weight:700;margin:0 0 7px;letter-spacing:-.01em}
.route p{font-size:14px;color:var(--mid);margin:0 0 16px;flex:1}
.route a{font-family:var(--sans);font-size:13px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;color:var(--gold-text);text-decoration:none;border-bottom:1px solid var(--gold);padding-bottom:3px;align-self:flex-start}
.route a:hover{color:var(--ink);border-color:var(--ink)}

footer{margin-top:44px;padding:26px 0 60px;border-top:1px solid var(--border);font-size:13.5px;color:var(--muted)}
footer b{color:var(--mid)}
footer p.frame{font-family:var(--sans);font-size:17px;font-weight:600;color:var(--ink);
  line-height:1.35;max-width:46ch;margin:0 0 18px;letter-spacing:-.01em}
footer a{color:var(--gold-text)}
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
</style>
</head>
<body>

<nav><div class="wrap">
  <svg class="mark" viewBox="0 0 200 200" aria-hidden="true">
    <defs><clipPath id="mk"><polygon points="30,0 200,0 200,170 170,200 0,200 0,30"/></clipPath></defs>
    <g clip-path="url(#mk)">
      <rect x="0" y="0" width="50" height="200" fill="#D4A829"/>
      <rect x="50" y="0" width="50" height="200" fill="#1A5C6E"/>
      <rect x="100" y="0" width="50" height="200" fill="#24214E"/>
      <rect x="150" y="0" width="50" height="200" fill="#0A0A0B"/>
    </g>
  </svg>
  <div class="word">Colour<br>Memory</div>
  <div class="spacer"></div>
  <a class="navlink" href="https://colourmemory.com/?utm_source=huggingface&utm_medium=space&utm_campaign=cm_space&utm_content=nav">colourmemory.com &rarr;</a>
</div></nav>

<div class="hero">
  <div class="bands" aria-hidden="true">
    <div style="background:#D4A829"></div><div style="background:#1A5C6E"></div>
    <div style="background:#24214E"></div><div style="background:#0A0A0B"></div>
  </div>
  <div class="wrap"><div class="inner">
    <div class="tagline">The evidence layer for colour</div>
    <h1>Your AI can generate a colour story in seconds.<em>It cannot tell you what that story rests on.</em></h1>
    <p class="answer">Colour Memory can.</p>
    <p>46,000+ sourced colour records. Evidence graded A&ndash;E. Unsupported claims explicitly
    refused. Provenance attached to every answer.</p>
  </div></div>
</div>

<div class="halt"><div class="wrap"><div class="inner">
  <h2>The uncomfortable bit</h2>
  <p class="lead">Your competitors can use the same models you can. The advantage is what you put
  underneath them.</p>
  <p>Colour Memory gives an agent access to evidence, provenance and claim limits that do not exist
  in the model's weights.</p>
  <p>Once a colour claim has shipped into a pitch, a product or a client deck, &ldquo;the AI said
  so&rdquo; is not a defence.</p>
</div></div></div>

<div class="wrap">
  <div class="ask">
    <div class="examples">
      <button class="ex" data-key="tube" type="button"><i style="background:#E32017"></i>A grade&nbsp;A record</button>
      <button class="ex" data-key="greek" type="button"><i style="background:#D83020"></i>A record that refuses</button>
    </div>
    <div class="freebie"><b>Two real Colour Memory results. No generated examples.</b>
    Look up any colour with an API key at <a href="https://colourmemory.com/docs.html?utm_source=huggingface&utm_medium=space&utm_campaign=cm_space&utm_content=api">colourmemory.com</a>.</div>
    <div id="status">Ready.</div>
  </div>
  <div id="out" aria-live="polite"></div>

  <div class="unlock">
    <h2>What you don't get from the model.</h2>
    <p class="sub">Retrieval and constraint rather than recall. Each one travels with the answer,
    so a claim can be checked at the point it is made.</p>
    <div class="only">
      <div>
        <div class="n">01 &mdash; The refusal</div>
        <h3>What the evidence does not support</h3>
        <p>Every record ships with the specific claims its evidence will not support, written per
        record rather than as a blanket disclaimer.</p>
        <div class="no">The Wada 1933 entry names a third-party site that mixes 30 invented palettes
        into the genuine 348, and tells you not to use it.</div>
      </div>
      <div>
        <div class="n">02 &mdash; The evidence grade</div>
        <h3>A record and an inference never look alike</h3>
        <p>A documented institutional record and a poetic inference never arrive looking equally
        trustworthy. A is a direct institutional record; E is inference only.</p>
        <div class="no">Most records are C. The system says so rather than flattering the corpus.</div>
      </div>
      <div>
        <div class="n">03 &mdash; The receipt</div>
        <h3>Source, method, record and version</h3>
        <p>The query, the method, the versions it ran against and the time it ran &mdash; attached to
        the answer, not reconstructed afterwards.</p>
        <div class="no">Anything the response does not supply is marked as not supplied, rather than
        filled in.</div>
      </div>
    </div>
  </div>
</div>

<div class="proof"><div class="wrap">
  <h2>Measured,<em>not marketed.</em></h2>
  <div class="stats">
    <div class="stat"><div class="n">46,000+</div><div class="l">Archive records</div></div>
    <div class="stat"><div class="n">82</div><div class="l">Archives</div></div>
    <div class="stat"><div class="n">91</div><div class="l">Live tools</div></div>
    <div class="stat"><div class="n">A&ndash;E</div><div class="l">Evidence grades</div></div>
  </div>
  <p class="fine">Counted, not estimated. Record and archive counts are the row and file counts the
  API reports; the tool count is the live MCP manifest.</p>
</div></div>

<div class="wrap">
  <div class="kicker">
    <p>Models already know how to guess about colour. Give yours evidence it can't safely invent.</p>
  </div>
  <div class="routes">
    <div class="route">
      <div class="lab">Designers</div>
      <h3>Colour Memory for Figma</h3>
      <p>Select a colour. Get its history, its grade and its limits without leaving the file.</p>
      <a href="https://colourmemory.com/figma.html?utm_source=huggingface&utm_medium=space&utm_campaign=cm_space&utm_content=figma">Get the plugin</a>
    </div>
    <div class="route">
      <div class="lab">AI builders</div>
      <h3>Colour evidence for MCP agents</h3>
      <p>Give MCP-compatible agents access to sourced colour evidence, claim limits and provenance.</p>
      <a href="https://colourmemory.com/connect.html?utm_source=huggingface&utm_medium=space&utm_campaign=cm_space&utm_content=mcp">Connect the server</a>
    </div>
    <div class="route">
      <div class="lab">Developers</div>
      <h3>The API</h3>
      <p>Retrieval, evidence grading, cultural risk and WCAG matrices in single calls.</p>
      <a href="https://colourmemory.com/docs.html?utm_source=huggingface&utm_medium=space&utm_campaign=cm_space&utm_content=api">API documentation</a>
    </div>
  </div>

  <footer>
    <p><b>A perceptual distance of 0.00 does not mean the historical object was this colour.</b>
    It means the hex you entered equals Colour Memory's stored value for that record. Archive hex
    values are computational editorial estimates derived from written descriptions and published
    specifications &mdash; not spectrophotometric measurements. Evidence grades run A, a direct
    institutional record, to E, poetic or literary inference only.</p>
    <p class="frame">Soon, every AI will be able to talk about colour. The advantage will belong to
    the ones that can prove what they say.</p>
    <p>Every result carries an Evidence Receipt, so the claim can be checked rather than trusted.
    <a href="https://colourmemory.com/?utm_source=huggingface&utm_medium=space&utm_campaign=cm_space&utm_content=nav">colourmemory.com</a></p>
  </footer>
</div>

<script>
// ---------------------------------------------------------------------------
// The Colour Memory API requires an API key. A static Space is fully readable
// by anyone who opens it, so no key belongs in this file and none is present.
// The examples below are real API responses, captured and shown verbatim.
// Live version data for the receipt comes from the public /health endpoint.
// ---------------------------------------------------------------------------
var CM_HEALTH = "https://api.colourmemory.com/health";

var out = document.getElementById("out"), statusEl = document.getElementById("status");
var HEALTH = null;

function setStatus(m) { statusEl.textContent = m; }
function esc(s) {
  return String(s == null ? "" : s).replace(/[&<>"']/g, function (c) {
    return { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }[c];
  });
}

var RECORDS = {
  tube: {
    captured: "2026-09-05T08:55:57Z", query: 'query_hex \u00b7 hex=#E32017 \u00b7 n_results=2',
    hex: "#E32017", display_name: "London Underground Line Colours",
    archive_source: "ColourStandards", dE2000: 0.0, match_quality: "Exact archive estimate",
    primary_source: "London Passenger Transport Board, Frank Pick's design programme, 1933, documented in the London Transport Museum; the line colour system formalised in the 1960 Beck diagram revision",
    claim_strength: "A", claim_strength_label: "Direct institutional record",
    claim_role: "anchor", hex_confidence: "moderate",
    do_not_say: [
      "Do not claim this hex was physically measured by Colour Memory \u2014 it is the holding institution's own catalogued reference value, not an independent spectrophotometric reading.",
      "Do not treat a dE2000 of 0 as proof of physical colour accuracy \u2014 it means the submitted hex matches the institution's catalogued reference value, not the object as it stands today."
    ]
  },
  greek: {
    captured: "2026-09-05T08:55:57Z", query: 'query_hex \u00b7 hex=#D83020 \u00b7 n_results=4',
    hex: "#D83020", display_name: "Greek Shield Blazon Red",
    archive_source: "AncientGreece", dE2000: 0.0, match_quality: "Exact archive estimate",
    primary_source: "", claim_strength: "E",
    claim_strength_label: "Poetic or literary inference only",
    claim_role: "provocation", hex_confidence: "speculative",
    do_not_say: [
      "Do not claim this hex was physically measured or documented by Colour Memory \u2014 it is a proposed reconstruction with no source directly on file.",
      "Do not treat a dE2000 of 0 as proof of physical colour accuracy \u2014 it means the submitted hex matches the proposed reconstruction, which is itself the thing in question.",
      "Do not describe this as a historical colour at all \u2014 it is a proposal about what may have existed; evidence grade is E (Poetic or literary inference only).",
      "Do not use this entry as load-bearing evidence in a sourced document without additional primary sourcing.",
      "Do not cite a primary source \u2014 none is recorded for this entry."
    ]
  }
};

function card(r) {
  var grade = String(r.claim_strength || "").toUpperCase(),
      de = typeof r.dE2000 === "number" ? r.dE2000.toFixed(2) : null,
      dns = r.do_not_say || [];
  var h = '<div class="card"><div class="top"><div class="chip" style="background:' + esc(r.hex) + '"></div><div>';
  h += '<div class="nm">' + esc(r.display_name) + '</div><div class="hx">' + esc(r.hex) +
       (r.archive_source ? " &middot; " + esc(r.archive_source) : "") + "</div></div>";
  h += '<div class="right">';
  if (de !== null) h += '<span class="de">&Delta;E ' + esc(de) + "</span>";
  if (grade) h += '<span class="g ' + esc(grade) + '">' + esc(grade) +
                  (r.claim_role ? " &middot; " + esc(r.claim_role.toUpperCase()) : "") + "</span>";
  h += "</div></div>";
  if (de !== null) {
    h += '<div class="blk"><span class="lab">Computed</span><div class="kv"><span>&Delta;E2000 <b>' +
         esc(de) + "</b></span>" + (r.match_quality ? "<span>match <b>" + esc(r.match_quality) + "</b></span>" : "") +
         "</div></div>";
  }
  h += '<div class="blk"><span class="lab">Documented</span><p>' +
       (r.primary_source ? esc(r.primary_source) : "<em>No primary source recorded for this entry.</em>") +
       "</p></div>";
  h += '<div class="blk"><span class="lab">Estimated / inferred</span><div class="kv"><span>evidence <b>' +
       esc(r.claim_strength_label) + "</b></span><span>hex confidence <b>" + esc(r.hex_confidence) +
       "</b></span><span>measured <b>no</b></span></div></div>";
  if (dns.length) {
    h += '<div class="blk limits"><span class="lab">Limits &mdash; do not claim</span><ul>';
    for (var i = 0; i < dns.length; i++) h += "<li>" + esc(dns[i]) + "</li>";
    h += "</ul></div>";
  }
  return h + "</div>";
}

var NOT_SUPPLIED = '<span style="color:var(--muted)">not supplied by this response</span>';

function receipt(r) {
  var rows = [
    ["query", esc(r.query)],
    ["method", "CIEDE2000 nearest named archive colours"],
    ["api_version", HEALTH && HEALTH.version ? esc(HEALTH.version) : NOT_SUPPLIED],
    ["archive_total", HEALTH && HEALTH.total_colours ? esc(String(HEALTH.total_colours)) : NOT_SUPPLIED],
    ["record_identifiers", NOT_SUPPLIED],
    ["captured_at", esc(r.captured)],
    ["rerun_current", "POST /query/hex {&quot;hex&quot;:&quot;" + esc(r.hex) + "&quot;} &middot; requires an API key"]
  ].map(function (x) {
    return '<div><span class="k">' + x[0] + '</span><span class="v">' + x[1] + "</span></div>";
  }).join("");
  return '<div class="card"><details class="receipt" open><summary>Evidence Receipt</summary>' +
    '<div class="body">' + rows +
    '<div style="margin-top:10px;color:var(--muted)">Version figures are read live from the public ' +
    '/health endpoint. rerun_current re-runs the API as it stands today; it does not reconstruct a ' +
    'past archive revision.</div></div></details></div>';
}

function show(key) {
  var r = RECORDS[key];
  if (!r) return;
  out.innerHTML = '<div class="egnote">Real API response &mdash; captured ' + esc(r.captured.slice(0, 10)) + '</div>' +
                  card(r) + receipt(r);
  setStatus(r.display_name + " \u00b7 grade " + r.claim_strength + " \u00b7 " + r.do_not_say.length + " stated limits.");
}

var currentKey = "tube";

var b = document.querySelectorAll(".ex");
for (var i = 0; i < b.length; i++) {
  b[i].addEventListener("click", function () {
    currentKey = this.getAttribute("data-key");
    show(currentKey);
  });
}

show(currentKey);

// Live version figures for the receipt, from the public /health endpoint.
// If it is unavailable the receipt says "not supplied" rather than guessing.
fetch(CM_HEALTH)
  .then(function (res) { return res.ok ? res.json() : null; })
  .then(function (d) { if (d) { HEALTH = d; show(currentKey); } })
  .catch(function () {});
</script>
</body>
</html>