Re: [csswg-drafts] [css-color-6] `contrast-color()` syntax proposal (#7954)

Wow, that ObservableHQ demo is sweet! 🤩

Not looking at the details/order of the syntax, I do see all the necessary parts are there. It reminds me of this syntax I [suggested](https://github.com/w3c/csswg-drafts/issues/7359#issuecomment-1203077069): 

> More syntax ideas:
> 
> * `contrast-color(foreground red using wcag2(AA) vs blue, white, yellow)`
> * `contrast-color(foreground red using wcag2(AA) / blue, white, yellow)` _(to make it more clear that it’s not 4 comma-separated items but something measured against 3 items)_

The main components are there, similar to Adam’s proposed syntax. Key difference though is that the `<contrast-algorithm>` is a function that accepts the wanted `<contrast-target>` as an argument.

This allows an algo to have more than 1 argument. The (unfinished) [wcag3](https://www.w3.org/TR/wcag-3.0/) for example also takes font weight and size into account, which could then be expressed as `wcag3(75, font-size, weight)`.

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


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

Received on Wednesday, 26 October 2022 09:14:48 UTC