Walked every tab on desktop and phone, clicked every link and button:
- Colours: new map inks and page colours, checked with simulated
protanopia/deuteranopia/tritanopia (worst pair ~12 CIEDE2000, was 1.4 for
Red/Green on the map and 9.7 for Orange/Brown on the page). Map label text
is always dark ink; dragon colour goes on borders. docs/COLOURS.md and
research/python/check_colours.py.
- Valley map: dragons get a paper halo and a visibility floor (faded ones never
drop below 0.3; bonding dragons start at 0.5); "no shadow" roll labelled
correctly.
- Wording: methods updated (strata, the newer form's questions, missing
answers, a new section on the solver, The Odds cards and genuine attempts);
findings use readable factor names and no longer claim a date adjustment;
'Load a newer route export above'; code links include solver.js and
explorer.js; The Odds shows 93% instead of '1 in 1'.
- Deep Dive route map treats all six dragons alike ('Bond a dragon' row,
default 'Bond any dragon'; rare sightings separate).
- Phone: Deep Dive no longer overflows (sections and selects can shrink).
- scripts/qa/crawl.js and mapcheck.js for future release checks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ
43 lines
2.7 KiB
Python
43 lines
2.7 KiB
Python
"""check_colours.py: are the dragon colours (valley.js INK, index.html --dr-*) still distinguishable?
|
|
|
|
python research/python/check_colours.py
|
|
"""
|
|
"""Pairwise CIEDE2000 between dragon colours, normal vision and simulated colour-vision deficiencies (Machado 2009, severity 1),
|
|
plus contrast against the backgrounds they sit on."""
|
|
import itertools, sys
|
|
import numpy as np
|
|
from skimage.color import rgb2lab, deltaE_ciede2000
|
|
|
|
MAP = {"Red": "#cc3346", "Orange": "#e08a2a", "Brown": "#4e3020", "Green": "#2f8f6f", "Blue": "#2a58b8", "Black": "#22182a"}
|
|
UI = {"Red": "#e8435e", "Orange": "#ff9533", "Brown": "#d1a47a", "Green": "#3fc0a8", "Blue": "#7ea6ff", "Black": "#e0d8ea"}
|
|
if len(sys.argv) > 1: # candidate palettes passed as name=hex,...
|
|
for arg in sys.argv[1:]:
|
|
k, v = arg.split(":", 1)
|
|
d = dict(x.split("=") for x in v.split(","))
|
|
(MAP if k == "map" else UI).update(d)
|
|
BG = {"map paper": "#e9c88f", "map canopy": "#6c6b40", "ui dark": "#210f19"}
|
|
M = { # Machado et al. 2009, severity 1.0, applied in linear RGB
|
|
"protan": [[0.152286, 1.052583, -0.204868], [0.114503, 0.786281, 0.099216], [-0.003882, -0.048116, 1.051998]],
|
|
"deutan": [[0.367322, 0.860646, -0.227968], [0.280085, 0.672501, 0.047413], [-0.011820, 0.042940, 0.968881]],
|
|
"tritan": [[1.255528, -0.076749, -0.178779], [-0.078411, 0.930809, 0.147602], [0.004733, 0.691367, 0.303900]],
|
|
}
|
|
def rgb(h): h = h.lstrip("#"); return np.array([int(h[i:i + 2], 16) for i in (0, 2, 4)]) / 255
|
|
def lin(c): return np.where(c <= 0.04045, c / 12.92, ((c + 0.055) / 1.055) ** 2.4)
|
|
def unlin(c): c = np.clip(c, 0, 1); return np.where(c <= 0.0031308, c * 12.92, 1.055 * c ** (1 / 2.4) - 0.055)
|
|
def sim(c, kind): return c if kind == "normal" else unlin(np.array(M[kind]) @ lin(c))
|
|
def lab(c): return rgb2lab(c.reshape(1, 1, 3)).reshape(3)
|
|
def de(a, b): return float(deltaE_ciede2000(lab(a), lab(b)))
|
|
def lum(c): l = lin(c); return 0.2126 * l[0] + 0.7152 * l[1] + 0.0722 * l[2]
|
|
def contrast(a, b): x, y = sorted([lum(a), lum(b)], reverse=True); return (x + 0.05) / (y + 0.05)
|
|
for name, P in [("MAP (on paper)", MAP), ("UI (on dark)", UI)]:
|
|
print(f"\n== {name}: pairs with CIEDE2000 < 20 under any vision (flag), worst first")
|
|
rows = []
|
|
for a, b in itertools.combinations(P, 2):
|
|
ds = {k: de(sim(rgb(P[a]), k), sim(rgb(P[b]), k)) for k in ["normal", "protan", "deutan", "tritan"]}
|
|
rows.append((min(ds.values()), a, b, ds))
|
|
for m, a, b, ds in sorted(rows):
|
|
if m < 20: print(f" {a:6} vs {b:6} " + " ".join(f"{k} {v:5.1f}" for k, v in ds.items()))
|
|
print(" contrast vs backgrounds:")
|
|
for c in P:
|
|
print(f" {c:6} " + " ".join(f"{bg} {contrast(rgb(P[c]), rgb(h)):.1f}" for bg, h in BG.items() if (bg.startswith('map') if P is MAP else bg.startswith('ui'))))
|