Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-color-6] color-contrast() syntax is confusing #7354

Closed
manuelmeister opened this issue Jun 14, 2022 · 3 comments
Closed

[css-color-6] color-contrast() syntax is confusing #7354

manuelmeister opened this issue Jun 14, 2022 · 3 comments
Labels
a11y-tracker Group bringing to attention of a11y, or tracked by the a11y Group but not needing response. Closed Accepted by CSSWG Resolution css-color-6

Comments

@manuelmeister
Copy link

manuelmeister commented Jun 14, 2022

Why do we use vs and not just something like this:

color-contrast() = color-contrast( <color> [ , <color>#{2,}  [ , to [<number> | AA | AA-large | AAA | AAA-large]]? ]? )

Because for me, the following looks like only maroon is tested to AA and only wheat and bisque are compared.

color-contrast(wheat vs bisque, darkgoldenrod, olive, sienna, darkgreen, maroon to AA)

I think this would be much more readable:

color-contrast(wheat, bisque darkgoldenrod olive sienna darkgreen maroon, to AA)
@LeaVerou
Copy link
Member

I agree that a keyword implies higher precedence than a comma, both in programming languages, as well as natural language. Every time I see a vs b, c I read it as (a vs b), c, rather than the intended a vs (b, c).

I like @fantasai's suggestion which I listed in #7359.

We should also not have metadata about the whole operation at the end of a comma-separated list. There is no precedent for that in CSS, and it makes it weird to read.

@LeaVerou LeaVerou changed the title [css-color-5] Make syntax of color-contrast() more like a math function [css-color-5] color-contrast() syntax is confusing Jun 14, 2022
@fantasai
Copy link
Collaborator

Yeah, the grammatical pattern we should follow here is probably linear-gradient() et al.

@LeaVerou LeaVerou added the a11y-tracker Group bringing to attention of a11y, or tracked by the a11y Group but not needing response. label Jun 15, 2022
@svgeesus svgeesus removed the css-color-5 Color modification label Jun 15, 2022
@svgeesus svgeesus changed the title [css-color-5] color-contrast() syntax is confusing [css-color-6] color-contrast() syntax is confusing Jun 22, 2022
@LeaVerou
Copy link
Member

LeaVerou commented Aug 2, 2022

Discussed in NYC F2F, discussion in #7359

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a11y-tracker Group bringing to attention of a11y, or tracked by the a11y Group but not needing response. Closed Accepted by CSSWG Resolution css-color-6
Projects
Status: Tuesday
Development

No branches or pull requests

4 participants