[csswg-drafts] [css-color-4] no contrast guarantee due to wrong threshold

xi has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-color-4] no contrast guarantee due to wrong threshold ==
https://drafts.csswg.org/css-color-4/#contrast-adjuster

The definition of the contrast adjuster says that if the base color has a luminance smaller than 0.5, *maximum-contrast color* should be white, otherwise black. In order to gurantee sufficient contrast, the threshold of 0.5 should be much smaller, somewhere between 0.1833 and 0.175.

Further explanaition:

The contrast ratio is calulated as `(L1 + 0.05) / (L2 + 0.05)` where L1 is the larger of the two luminances, and L2 is the smaller. Luminance is between 0 and 1.

To find the highest luminance that still has sufficient contrast with white, we can solve the following formular for `L`: `(1 + 0.05) / (L + 0.05) = 4.5 => L = (1 + 0.05) / 4.5 - 0.05 ~= 0.1833`.

To find the lowest luminance that still has sufficient contrast wit black, we can solve the following formular for `L`: `(L + 0.05) / (0 + 0.05) = 4.5 => L = (0 + 0.05) * 4.5 - 0.05 = 0.175`.

Note that luminances between these two values offer sufficient contrast to both black and white.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1632 using your GitHub account

Received on Thursday, 20 July 2017 14:14:21 UTC