Skip to content

[css-color-5] Add the none keyword to light-dark()#13712

Merged
svgeesus merged 1 commit intow3c:mainfrom
yisibl:add-light-dark-none
Mar 24, 2026
Merged

[css-color-5] Add the none keyword to light-dark()#13712
svgeesus merged 1 commit intow3c:mainfrom
yisibl:add-light-dark-none

Conversation

@yisibl
Copy link
Copy Markdown
Contributor

@yisibl yisibl commented Mar 24, 2026

Fixes: #12513 (comment)

This means that light-dark(url(foo.png), none) will be a valid value. The none keyword is equivalent to linear-gradient(transparent), but is more intuitive.

This also makes conditional checks in @supports more concise:

@supports ( background: light-dark(none, none) ) { }

In addition, none is also supported in -webkit-cross-fade(), See: https://github.com/web-platform-tests/wpt/blob/0efed9003fb6c920d404928776fc9a400bb78560/css/css-images/cross-fade-legacy-crash.html#L8

w3c#12513 (comment)

This means that `light-dark(url(foo.png), none)` will be a valid value.
The `none` keyword is equivalent to `linear-gradient(transparent)`, but is more intuitive.

This also makes conditional checks in `@supports` more concise:

```css
@supports (light-dark(none, none)) { }
```

In addition, `none` is also supported in `-webkit-cross-fade()`, See:
https://github.com/web-platform-tests/wpt/blob/0efed9003fb6c920d404928776fc9a400bb78560/css/css-images/cross-fade-legacy-crash.html#L8
@yisibl
Copy link
Copy Markdown
Contributor Author

yisibl commented Mar 24, 2026

@svgeesus PTAL

@w3cbot
Copy link
Copy Markdown

w3cbot commented Mar 24, 2026

yisibl marked as non substantive for IPR from ash-nazg.

@svgeesus
Copy link
Copy Markdown
Contributor

Thanks, but I am not going to merge this because it is better to add none to the <image> type so it can be used consistently anywhere that takes an <image>.

@svgeesus svgeesus closed this Mar 24, 2026
@tabatkins
Copy link
Copy Markdown
Member

We should, in fact, merge this one. The other one mixes in a separate idea that doesn't have a resolution (and almost certainly won't, as it has compat issues)

@tabatkins tabatkins reopened this Mar 24, 2026
@svgeesus
Copy link
Copy Markdown
Contributor

Yeah, I see from @LeaVerou that will not fly

@w3cbot
Copy link
Copy Markdown

w3cbot commented Mar 24, 2026

svgeesus marked as non substantive for IPR from ash-nazg.

@svgeesus svgeesus merged commit 100146f into w3c:main Mar 24, 2026
3 checks passed
@yisibl yisibl deleted the add-light-dark-none branch March 25, 2026 08:51
@yisibl
Copy link
Copy Markdown
Contributor Author

yisibl commented Mar 25, 2026

@svgeesus @tabatkins Thank you for the quick review.

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Mar 26, 2026
Move light-dark-image.html from css-color to css-images and expand test
coverage for the light-dark() image form per the CSS Color 5 spec [1].
The original test only covered background-image with url and none values
plus basic invalid cases.

New test coverage includes:
- Support for none, See [2][3]
- Gradient values (linear, radial, conic, repeating-linear)
- Mixed image types (url + gradient, none + gradient)
- Other image properties (list-style-image, border-image-source,
  content)
- Serialization round-trip
- Inheritance with color-scheme propagation
- Dynamic color-scheme changes
- Additional invalid cases (mixed color/image args, three args)

[1]: https://un5n798jx6qx6j0rmf2verhh.julianrbryant.com/css-color-5/#light-dark
[2]: w3c/csswg-drafts#12513 (comment)
[3]: w3c/csswg-drafts#13712

Bug: 491829958
Change-Id: Iff688354156603c8b80efa80efd9d8ef25e00709
beckysiegel pushed a commit to chromium/chromium that referenced this pull request Mar 26, 2026
Move light-dark-image.html from css-color to css-images and expand test
coverage for the light-dark() image form per the CSS Color 5 spec [1].
The original test only covered background-image with url and none values
plus basic invalid cases.

New test coverage includes:
- Support for none, See [2][3]
- Gradient values (linear, radial, conic, repeating-linear)
- Mixed image types (url + gradient, none + gradient)
- Other image properties (list-style-image, border-image-source,
  content)
- Serialization round-trip
- Inheritance with color-scheme propagation
- Dynamic color-scheme changes
- Additional invalid cases (mixed color/image args, three args)

[1]: https://un5n798jx6qx6j0rmf2verhh.julianrbryant.com/css-color-5/#light-dark
[2]: w3c/csswg-drafts#12513 (comment)
[3]: w3c/csswg-drafts#13712

Bug: 491829958
Change-Id: Iff688354156603c8b80efa80efd9d8ef25e00709
Reviewed-on: https://un5x4n0kwa1t164zhzvdp2b4bu49r4r40ry9xdr.julianrbryant.com/c/chromium/src/+/7686627
Commit-Queue: Jason Leo <cgqaq@chromium.org>
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1605272}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Mar 26, 2026
Move light-dark-image.html from css-color to css-images and expand test
coverage for the light-dark() image form per the CSS Color 5 spec [1].
The original test only covered background-image with url and none values
plus basic invalid cases.

New test coverage includes:
- Support for none, See [2][3]
- Gradient values (linear, radial, conic, repeating-linear)
- Mixed image types (url + gradient, none + gradient)
- Other image properties (list-style-image, border-image-source,
  content)
- Serialization round-trip
- Inheritance with color-scheme propagation
- Dynamic color-scheme changes
- Additional invalid cases (mixed color/image args, three args)

[1]: https://un5n798jx6qx6j0rmf2verhh.julianrbryant.com/css-color-5/#light-dark
[2]: w3c/csswg-drafts#12513 (comment)
[3]: w3c/csswg-drafts#13712

Bug: 491829958
Change-Id: Iff688354156603c8b80efa80efd9d8ef25e00709
Reviewed-on: https://un5x4n0kwa1t164zhzvdp2b4bu49r4r40ry9xdr.julianrbryant.com/c/chromium/src/+/7686627
Commit-Queue: Jason Leo <cgqaq@chromium.org>
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1605272}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Mar 26, 2026
Move light-dark-image.html from css-color to css-images and expand test
coverage for the light-dark() image form per the CSS Color 5 spec [1].
The original test only covered background-image with url and none values
plus basic invalid cases.

New test coverage includes:
- Support for none, See [2][3]
- Gradient values (linear, radial, conic, repeating-linear)
- Mixed image types (url + gradient, none + gradient)
- Other image properties (list-style-image, border-image-source,
  content)
- Serialization round-trip
- Inheritance with color-scheme propagation
- Dynamic color-scheme changes
- Additional invalid cases (mixed color/image args, three args)

[1]: https://un5n798jx6qx6j0rmf2verhh.julianrbryant.com/css-color-5/#light-dark
[2]: w3c/csswg-drafts#12513 (comment)
[3]: w3c/csswg-drafts#13712

Bug: 491829958
Change-Id: Iff688354156603c8b80efa80efd9d8ef25e00709
Reviewed-on: https://un5x4n0kwa1t164zhzvdp2b4bu49r4r40ry9xdr.julianrbryant.com/c/chromium/src/+/7686627
Commit-Queue: Jason Leo <cgqaq@chromium.org>
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1605272}
lando-worker bot pushed a commit to mozilla-firefox/firefox that referenced this pull request Apr 4, 2026
… for light-dark() images, a=testonly

Automatic update from web-platform-tests
[css-images] Add comprehensive WPT tests for light-dark() images

Move light-dark-image.html from css-color to css-images and expand test
coverage for the light-dark() image form per the CSS Color 5 spec [1].
The original test only covered background-image with url and none values
plus basic invalid cases.

New test coverage includes:
- Support for none, See [2][3]
- Gradient values (linear, radial, conic, repeating-linear)
- Mixed image types (url + gradient, none + gradient)
- Other image properties (list-style-image, border-image-source,
  content)
- Serialization round-trip
- Inheritance with color-scheme propagation
- Dynamic color-scheme changes
- Additional invalid cases (mixed color/image args, three args)

[1]: https://un5n798jx6qx6j0rmf2verhh.julianrbryant.com/css-color-5/#light-dark
[2]: w3c/csswg-drafts#12513 (comment)
[3]: w3c/csswg-drafts#13712

Bug: 491829958
Change-Id: Iff688354156603c8b80efa80efd9d8ef25e00709
Reviewed-on: https://un5x4n0kwa1t164zhzvdp2b4bu49r4r40ry9xdr.julianrbryant.com/c/chromium/src/+/7686627
Commit-Queue: Jason Leo <cgqaq@chromium.org>
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1605272}

--

wpt-commits: 67a3616a7aebb50d2e514052aeacfe44e7032076
wpt-pr: 58744
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[css-images-4] Add light-dark-image(), or generalize light-dark() for images too?

4 participants