Files
loki/scripts
cb64cdab9d fix(audit): composite translucent layers before judging contrast (#314)
The contrast audit I shipped an hour ago had the exact defect it was
written to catch. bgOf() took the first non-transparent ancestor
background and treated it as opaque — but the fleet chips are
oklch(1 0 0 / 0.04), a 4%-white overlay on a near-black card. Painted
once, that resolves to SOLID WHITE, so the audit computed dark-grey text
against white and invented failures on text that reads fine.

Colours now resolve to straight RGBA by painting twice over known
backdrops and solving for alpha (white - black = 255*(1-a)), which also
handles oklch/lab/color-mix syntax that no regex can parse. Every
translucent layer between the element and the first opaque ancestor is
then composited, because that stack is what the eye actually sees behind
the glyphs. Translucent text is composited onto its own backdrop too.

Effect on the live /control run: 21 findings → 19. The two that vanished
were chips, exactly as predicted. Everything else is unchanged, so the
headline result stands: the primary CTA "Launch agent" really is 3.03:1.

Co-authored-by: t <t@t.t>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-16 11:22:24 +00:00
..