Re: [csswg-drafts] [css-values-5] Using `if()` to do dark/light switching of image urls. (#10577)

Hi! I wanted to chime in about expanding `light-dark()` itself to support any type, as mentioned in this interop issue. (I've been told to discuss it here instead)

https://github.com/web-platform-tests/interop/issues/841#issuecomment-2401610759

---

>  It was put to the side pending more use-cases, because it requires giving it var()-like semantics, which isn't as good as a function with a proper type (like light-dark(), which is a <color>).

Why is it not possible to give `light-dark()` semantics more similar to  `calc` instead? Instead of `light-dark()` being `any`-typed, it should be the same type as the arguments within.

- `light-dark(<color>, <color>)` has the type of `<color>`
- `light-dark(<url>, <url>)` has the type `<url>`
- ... and so on

If this is possible it would solve the regressions caused by opening up `light-dark()` to non color values.

The use-case I want more than anything else is:

```css
color-scheme: light-dark(dark, light);
```

I.e., I want to be able to "flip" the current color scheme within a particular HTML element.

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


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

Received on Wednesday, 9 October 2024 17:26:45 UTC