Re: [csswg-drafts] [css-color-6] color-contrast() should allow specifying multiple contrast algorithms that need to be satisfied (#7357)

> ### Regarding the infinity fix:
> in Weber.js, there is:
> 
> ```js
>     return Y2 === 0 ? 0 : (Y1 - Y2) / Y2;
> ```
> 
> To fix devide by 0, which would be infinity. But in returning 0, it hides that the actual result should be a _maximum_. As a result, in the black/white page, the Weber shows white text, when in reality it should show black text for all cases similar to Michelson, due to the nature of these algorithms.
> 
> If I may suggest to consider instead:
> 
> ```js
>     return Y2 === 0 ? 50000 : (Y1 - Y2) / Y2;
> ```
> 
> The reason: the darkest sRGB color above black is `#000001` and this produces a plain Weber contrast of ~45647. So, setting the divide-by-zero result at 50000 is a reasonable max clamp for the plain Weber.
> 

Pull request?

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 10 August 2022 08:55:38 UTC