-
Notifications
You must be signed in to change notification settings - Fork 741
Description
In the current draft, transparency is ignored when calculating contrast, because it was ignored in WCAG 2.1 as there were no non-opaque colors then.
However, this could result in completely incorrect results.
Consider this example: color-contrast(white vs rgb(0 0 0 / .1), gray)
. Because transparency is ignored, it would pick rgb(0 0 0 / .1)
as most contrasting, which produces this result:
whereas picking gray
would have produced this much more legible result:
At the very least, UAs should perform alpha blending of background and foreground (see #7359 ). This would be sufficient when the background is opaque, but it does not solve the problem when the background is also semi-transparent. Ideally, UAs would calculate a range of contrasts and a color would be deemed a winner IFF the minimum possible contrast also passes the desired level (I did some work on calculating said range in WCAG 2.1 10 years ago, not sure if there's a better method these days)
(Issue filed following breakout discussions between @svgeesus, @fantasai, @argyleink and myself)
Resolutions
Aug 2, 2022
RESOLVED: When calculating color contrast between pairs of semi transparent colors, if the background is opaque, UAs should alpha blend the foreground on the background and use that as the foreground color. If the background is also semi-transparent, it would be alpha blended first with an opaque version of the foreground
RESOLVED: Amend previous resolution, the canvas color in previous resolution is TBD
RESOLVED: (rather than opaque version of foreground)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status