Skip to content

Make every text colour legible on the surface it is drawn on - #192

Merged
vmillet-dev merged 1 commit into
mainfrom
text-that-passes-aa
Sep 18, 2026
Merged

vmillet-dev merged 1 commit into
mainfrom
text-that-passes-aa

Conversation

@vmillet-dev

Copy link
Copy Markdown
Owner

Closes #175.

--text-2 is the second most used colour in the application — 129 declarations across 45 files — and it cleared AA on none of the four surfaces. 76 of those declarations pair it with a font-size below 12px, which is precisely where 4.5:1 applies.

What changed

Five hexes and three rgb triplets in styles.scss. No call site.

was worst now worst
dark --text-2 #6e7488 2.92 #9298ac 4.72
light --text-2 #767d90 3.48 #636a7c 4.57
light --amber #9c6410 4.18 #8f5b0d 4.83
dark --red #d1706f 4.04 #dc8281 4.88
light --green #2c7a4b 4.44 #297044 5.08

⚠️ --green was not in the ticket. I had called it "borderline" in the audit and only listed amber and red; it is 4.44 on --bg-3 and it is text — highlight.js colours strings with it, and --folder-hue is drawn as text in a board zone. Leaving it would have made the test below fail on the first run.

The darker light amber also improves the label drawn on it: --amber-ink goes from 4.69 to 5.42.

The test

scripts/palette.test.mjs, parsing the shipped stylesheet. Three things it holds per theme: every text colour on every plain surface, the ink on solid amber, and — the one that stops the file rotting — a verdict on every colour declared, so a colour added to the palette fails until somebody says whether it is text.

⚠️ It is a node --test file and not a *.spec.ts. It reads a file off disk, and the Angular builder compiles its specs for a browser: node:fs is not typed there (tsconfig.spec.json sets types: [] and @types/node is not a dependency) and ?raw has no esbuild loader. Both were tried and both fail; scripts/ is the escape hatch the repository already documents for exactly this. It had to be added to the test:scripts command by name — Node 24 does not expand a bare directory.

I checked it fails on the old palette, or it would prove nothing:

--text-2 (#6e7488) on --bg-0 (#15171c) is 3.86:1, AA asks 4.5:1

Looked at, not only computed

Built the e2e flavour and photographed the canvas and the editor in both themes. The secondary text is legible where it was ghostly, the three-level hierarchy still reads, and nothing looks washed out — which was the risk in raising a dim grey.

What this does not fix, and why

tint-badge draws a hue as text on a tint of itself, which moves the background toward the text and costs about a point. Light amber at 12% is still 4.20:1 after this change — it is the "N'expire jamais" badge, the faintest text on the light editor. Fixing it is a design choice (lower the alpha / darken the hue again / stop drawing the hue as its own text), not arithmetic, so it is #191 with the measurements rather than a silent extra commit here. The test's comment says plainly that it does not cover the composite.

🤖 Generated with Claude Code

--text-2 is the second most used colour in the application, 129 declarations
across 45 files, and it reached 4.5:1 on none of the four surfaces: 2.92 at
worst in dark, 3.48 in light. Seventy-six of those declarations pair it with a
font-size under 12px, which is exactly where AA asks for 4.5.

Four other values were under on at least one surface: light --amber, light
--green and dark --red. Five hexes and three rgb triplets change, no call site
does.

The test lives in scripts/ rather than beside the stylesheet: it reads the
shipped file, and the Angular builder compiles its specs for a browser, where
node:fs is absent and ?raw has no loader. Both were tried. It also fails on a
colour it cannot classify, so the next one added has to say whether it is text.

Deliberately out of scope, and filed as #191: tint-badge draws a hue on a tint
of itself, which costs about a point of contrast the plain-surface figures do
not see.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vmillet-dev vmillet-dev added this to the v0.3.1 — Room to work milestone Sep 18, 2026
@vmillet-dev vmillet-dev added the bug Something isn't working label Sep 18, 2026
@vmillet-dev
vmillet-dev merged commit 0294a58 into main Sep 18, 2026
11 checks passed
@vmillet-dev
vmillet-dev deleted the text-that-passes-aa branch September 18, 2026 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The dimmest text in the palette fails AA on every surface it is drawn on

1 participant