Re: [csswg-drafts] [css-color-4] no contrast guarantee on semi-transparent colors

@xi 

It's one thing to _calculate_ a worst-case contrast ratio for a given color pair when one is semi-transparent, but I don't think there's going to be a way to generate a good color from it.  The fix for white text on white+semi-transparent black might be to make the text darker.  But then what happens if the layer behind the background is black?  Your fix just became a problem of its own.  

But the entire section confuses me. From the syntax, I'm not sure how you specify both colors (the background and the desired foreground).  It looks like it is just starting from the base color as the background and then generating a shade of _that_ color (hue and saturation) that meets the desired contrast level.  So are you then supposed to use that result in a separate adjusting function, to adjust the luminance of your desired foreground color?

Giana Blantin's [Sass functions show one possible API for a "fix contrast" function that might be more clear](https://codepen.io/giana/project/full/ZWbGzD).

-- 
GitHub Notification of comment by AmeliaBR
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1628#issuecomment-318395292 using your GitHub account

Received on Thursday, 27 July 2017 15:22:54 UTC