Re: [csswg-drafts] [css-color-5] Support `light-dark(<color>, <image>)` by producing a dimensionless image for `<color>` (#13724)

Although this is the same as what I suggested in a [comment over there](https://github.com/w3c/csswg-drafts/issues/12513#issuecomment-4091181812), i.e. always return `<image>` if one parameter is of that type, I would actually prefer if the whole resolution of #12513 could be reconsidered.

With it, there currently are several separate functions that return an `<image>` by some criterion:

- [`light-dark()`](https://drafts.csswg.org/css-color-5/#light-dark) toggles between two options by the active _color scheme_.
- [`image-set()`](https://drafts.csswg.org/css-images-4/#image-set-notation) selects from a list of options by a declared resource property:
  * _image resolution_, 
  * _image format / file type_,
  * possibly the native/natural _image size_ or intended _display size_ in a future level,
  * or a combination thereof.
- [`image()`](https://drafts.csswg.org/css-images-4/#image-notation) may 
  * flip an image to match _text direction_,
  * crop to a _part_ of the image,
  * imagify a plain _color_,
  * specify a _fallback_ for unavailable resources. 
- [`cross-fade`](https://drafts.csswg.org/css-images-4/#cross-fade-function) blends multiple images into one. 

I believe that most of this could and possibly should be done in a single unified `image()` function, e.g.:

~~~~ ebnf
<image> = <url> | <image()> | <cross-fade()> | <element()> | <gradient>

<image()> = image[-set]?( <image-candidate># )

<image-candidate> = <image-tags>? <image-src> <image-property>? <image-part>?

<image-tags> = [ ltr | rtl ] || [ light | dark ]
            ~= <'direction'> || <'color-scheme'>

<image-src> = [ <url> | <string> | <color> | <gradient> ]
           ~= [ <image> | <color>]

<image-property> = [ <resolution> || <image-type> || <length> <length>? ]

<image-type> = type( [image/]? <ident> | <string> )

<image-part> = <basic-shape>
~~~~


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


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

Received on Friday, 27 March 2026 17:16:19 UTC