Intent to prototype and ship: light-dark() color function

44 views
Skip to first unread message

Emilio Cobos Álvarez

unread,
Oct 4, 2023, 1:18:29 PM10/4/23
to Mozilla
Summary: Allow authors to react to the used color-scheme like system
colors do.

See the discussion in [1] for discussions about use cases and future
extensions.

This is a rather simple feature that proves to be very useful to define
color-scheme-dependent values, and specially useful if those values
might be used in both light and dark contexts in the same page.

We've enabled it in the Firefox front-end for a while and it's getting
some usage[2], allowing clean-ups and fixes like this[3].

Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1856999
Specification: css-color-5, tentatively[4].
Platform coverage: all
Preference: layout.css.light-dark.enabled
DevTools bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1857006
Link to standards-positions discussion: None (should I file it?)

Other browsers: We'd be the first ones to ship the first implementing,
but the feeling in the CSSWG was pretty positive every time this has
come up, including both Blink and WebKit folks. In fact, Blink already
has an -internal-light-dark() function with essentially the same
functionality as we resolved on.

web-platform-tests: I'm adding WPTs as part of this work.

-- Emilio

[1]: https://github.com/w3c/csswg-drafts/issues/7561
[2]: https://searchfox.org/mozilla-central/search?q=light-dark%28
[3]: https://phabricator.services.mozilla.com/D190070
[4]: https://github.com/w3c/csswg-drafts/pull/9439
Reply all
Reply to author
Forward
0 new messages