Re: [csswg-drafts] [css-color-5] add target contrast ratio to color-contrast? (#4749)

@una I believe that still runs contrary to the current function of `color-contrast`, which is to get the best possible color from a set of colors. This is definitely just personal opinion, but I find that "get a color with an acceptable contrast ratio" would be much more useful than "get a color that is closest to this ratio, even if it fails to pass this ratio." Its definitely worth hearing more people's opinions on this, though.

@svgeesus I may have explained it poorly too, lol. The issue I have with it is say if multiple colors in the set have a greater ratio than the target, it will select the worst of the bunch. For example, if I have `color-contrast(#000 #FFF, #CCC, #333 13.0)`, it will select `#CCC`, despite it being the worst of the two that pass the ratio requirement. Whereas the `color-contrast` function without a ratio would return `#FFF`.

In the case where none of the provided colors meet the required ratio, how would designers implement a fallback to this? They could potentially just "chain" the same `color-contast` function (without a ratio specified), but then this would 1) not provide an acceptable ratio and 2) be much less ergonomic than using a single function, as it would require them to do something like:
```
.class {
    color: contrast-color(#000 #111, #222, #333);

    /* Fails to pass contrast check; I assume this is an invalid property value, so it will fallback to above  */
    color: contrast-color(#000 #111, #222, #333 3.0);
}
```

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

Received on Thursday, 6 February 2020 02:07:09 UTC