The 'only' keyword has been re-added to the specification for color-scheme as a way of per-element opt-out of color-scheme override like forced darkening.
Previously, both declarations below would force the div element into color-scheme dark and apply forced darkening. With this change, the second declaration would opt-out of forced darkening and keep the used color-scheme 'light'.
div { color-scheme: light } div { color-scheme: only light } will keep the color-scheme for the element light and opt-out of forced darkening.
This feature is already enabled as part of an original trial in M96: https://chromestatus.com/features/5672533924773888
Low risk: WebView has shipped forced darkening. This change means content loaded in WebViews may opt out of forced darkening with "color-scheme: only light;" where it previously would see 'only' as an unrecognized color-scheme and for 'light' into 'dark'. Low risk: Making 'only' a recognized keyword instead of a color-scheme means the parser will no longer accept multiple instances of 'only' in the same declaration, so declarations like this will be dropped: div { color-scheme: only only dark } WebKit already recognized 'only' as an opt-out of forced darkening keyword.
The existing property and the new keyword should automatically be supported in devtools. There is possibly a need for force dark / color-scheme override debugging support in devtools, but that is out of scope for this minor change.
DevTrial on desktop | 96 |
DevTrial on android | 96 |
DevTrial on Webview | 96 |
Debuggability
The existing property and the new keyword should automatically be supported in devtools. There is possibly a need for force dark / color-scheme override debugging support in devtools, but that is out of scope for this minor change.
Hi,
Some comments inline.
On 27/10/2021 16:09, Rune Lillesveen wrote:
> Summary
>
> The 'only' keyword has been re-added to the specification for
> color-scheme as a way of per-element opt-out of color-scheme override
> like forced darkening.
I guess this is the CSSWG discussion about re-adding it:
https://github.com/w3c/csswg-drafts/issues/5089
> Previously, both declarations below would force the div element into
> color-scheme dark and apply forced darkening. With this change, the
> second declaration would opt-out of forced darkening and keep the used
> color-scheme 'light'.
>
> div { color-scheme: light } div { color-scheme: only light } will keep
> the color-scheme for the element light and opt-out of forced darkening.
Let me clarify this comment, this is happening when we're in forced
darkening, am I right?
First I read it too quickly and "color-scheme: light" forcing the DIV
into color-scheme dark was weird.
> This feature is already enabled as part of an original trial in M96:
> https://chromestatus.com/features/5672533924773888
> <https://chromestatus.com/features/5672533924773888>
Do we have any results to comment from the origin trial? Or it was
mostly for auto dark mode and this was just a small bit of it?
> Gecko: In development
> (https://bugzilla.mozilla.org/show_bug.cgi?id=1576289
> <https://bugzilla.mozilla.org/show_bug.cgi?id=1576289>) Development of
> the color-scheme property in progress. At least blocker issues are being
> fixed.
Not sure if this is in development, as there seems to be not recent
activity on the bug; but they indeed look interested in implementing
color-scheme property. Do we have any feedback from Mozilla about this
"only" keyword?
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/e80ef8af-d68e-52ea-5238-773739cccb78%40igalia.com.