You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think an important consideration to make when implementing such a feature (and the reason why colord may not support it yet) is that the computation of contrast/readability should take into account also the underlying "background" color.
For example:
colord("#ffffff").isReadable("#ff000080"); // true (white on 50% transparent red)
should return very different results if the color "underlying" the transparent red is black or white.
In short, the contrast calculation should be done against the equivalent "compound" solid color
Update: as @t-hamano pointed out in WordPress/gutenberg#47373 (comment) , the mix plugin could be used to calculate the compound color, which can then be fed to the relevant a11y util
The a11y plugin doesn't support opacity. It would be great if it did.
Black on white = 21
colord('#000000').contrast('#FFFFFF')
Transparent black on white = 21, even though the text is invisible.
colord('#00000000').contrast('#FFFFFF')
Black on white is readable
colord('#000000').isReadable('#FFFFFF')
Transparent black on white is readable, even though the text is invisible.
colord('#00000000').isReadable('#FFFFFF')
The text was updated successfully, but these errors were encountered: