Re: [csswg-drafts] [css-color-4] Concerns about color() function fallback (#5931)

> Also, the folks using preprocessor variables may have their preferences as to avoid the MQ mechanism (or perhaps not).

The 2020 HTTP Archive Web Almanac [looked at usage of the `color()` function](https://almanac.httparchive.org/en/2020/css#color), which was vanishingly small (only 29 mobile and 36 desktop pages using it!). Because the numbers were so small, I could individually examine each of the stylesheets that used it. **All** were using some sort of fallback, wither with `@supports` test or a media query. None were using the `color()` fallback itself, likely because Safari was the only implementation at the time and does not support the fallback syntax. But also, likely, because the existing CSS fallback mechanisms of document order, `@supports` and media queries are more familiar and entirely suited to the task.

> Additionally, I am not quite clear how well destination dependent fallback will work with upcoming features like `color-mix()`, https://drafts.csswg.org/css-color-5/#color-mix and `color-adjust()`, https://drafts.csswg.org/css-color-5/#coloradjust. 

That is a valid concern and indeed, requires a lot of extra specification work to handle that case.

@tabatkins  also mentioned that supporting the fallback would make the Typed Object Model more complex for `@color()`.

So why do we have it? Well, ICC and Lab colors were in SVG before they were in CSS; and SVG was able (at the request of the XSL working group, to make generating SVG with XSLT easier) to use presentation attributes as well as CSS stylesheets. And in the case of a presentation attribute, media queries were not available and `@supports` did not exist, and an attribute can only be specified once in XML. 

So there was a need for a fallback; [SVG ICC colors](https://www.w3.org/TR/SVGColor12/#icc-colors) and [SVG Lab color](https://www.w3.org/TR/SVGColor12/#LAB) had a fallback. Note that the syntax there is different, the fallback came first.

Looking again at this, I think the fallback syntax has _no benefit for CSS_, and _adds complexity and cost_ for no good reason, and I would be totally fine dropping it!


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


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

Received on Thursday, 25 February 2021 22:03:50 UTC