[bug] lint_design contrast treats gradient (and translucent) backgrounds as white #24

Closed
opened 2026-10-27 18:41:58 +00:00 by masi · 1 comment
Owner

Expected: contrast rule samples a gradient background (e.g. its average or darkest/lightest stop) and composites rgba fills over the ancestor, so light text on a dark gradient passes.
Actual: text on a frame whose only fill is a gradient is checked against #ffffff ("text #cdd6f4 on #ffffff is 1.4:1"); text on translucent rgba fills is composited onto white (#b8b8b8, #c7c7c7). Every text layer in a dark gradient design reports an error.
Repro: create_artboard 400x200, write_html <div style="background:radial-gradient(#2a2140 0%, #0d0d14 100%);padding:24px"><div style="color:#cdd6f4;font-size:14px">Hello</div></div>, lint_design → contrast error 1.4:1 on #ffffff.
Workaround: none short of adding a solid fill; ignore the errors.
Impact: dozens of false errors per page hide real contrast problems.


Filed from PaperCraft 0.7.3 (macos).

**Expected:** contrast rule samples a gradient background (e.g. its average or darkest/lightest stop) and composites rgba fills over the ancestor, so light text on a dark gradient passes. **Actual:** text on a frame whose only fill is a gradient is checked against #ffffff ("text #cdd6f4 on #ffffff is 1.4:1"); text on translucent rgba fills is composited onto white (#b8b8b8, #c7c7c7). Every text layer in a dark gradient design reports an error. **Repro:** create_artboard 400x200, write_html `<div style="background:radial-gradient(#2a2140 0%, #0d0d14 100%);padding:24px"><div style="color:#cdd6f4;font-size:14px">Hello</div></div>`, lint_design → contrast error 1.4:1 on #ffffff. **Workaround:** none short of adding a solid fill; ignore the errors. **Impact:** dozens of false errors per page hide real contrast problems. --- Filed from PaperCraft 0.7.3 (macos).
masi closed this issue 2026-10-27 21:02:26 +00:00
Author
Owner

Fixed in 75faf3e on branch debrand.

Fixed in 75faf3e on branch debrand.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: masi/papercraft#24