Skip to content

Commit 1d2fd71

Browse files
committed
[mediaqueries-5] Remove (prefers-color-scheme: no-preference) per WG resolution. Add a note explaining the removal, and another explaining the preferred usage of the feature.
1 parent dac1559 commit 1d2fd71

1 file changed

Lines changed: 25 additions & 9 deletions

File tree

mediaqueries-5/Overview.bs

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ Detecting the desire for light or dark color schemes: the 'prefers-color-scheme'
619619

620620
<pre class='descdef mq'>
621621
Name: prefers-color-scheme
622-
Value: no-preference | light | dark
622+
Value: light | dark
623623
For: @media
624624
Type: discrete
625625
</pre>
@@ -628,24 +628,27 @@ Detecting the desire for light or dark color schemes: the 'prefers-color-scheme'
628628
desire that the page use a light or dark color theme.
629629

630630
<dl dfn-type=value dfn-for="@media/prefers-color-scheme">
631-
<dt><dfn>no-preference</dfn>
632-
<dd>
633-
Indicates that the user has made no preference known
634-
to the system. This keyword value evaluates as false
635-
in the <a>boolean context</a>.
636-
637631
<dt><dfn>light</dfn>
638632
<dd>
639633
Indicates that user has expressed the preference for
640-
a page that has a light theme (dark text on light background).
634+
a page that has a light theme (dark text on light background),
635+
or has not expressed an active preference
636+
(and thus should receive the "web default" of a light theme).
641637

642638
<dt><dfn>dark</dfn>
643639
<dd>
644640
Indicates that user has expressed the preference for
645641
a page that has a dark theme (light text on dark background).
646-
647642
</dl>
648643

644+
Note: The values for this feature might be expanded in the future
645+
(to express a more active preference for light color schemes,
646+
or preferences for other types of color schemes like "sepia").
647+
As such, the most future-friendly way to use this media feature
648+
is by directly testing against the values you wish to match,
649+
such as ''(prefers-color-scheme: light)'' and ''(prefers-color-scheme: dark)'',
650+
rather than by negation such as ''(prefers-color-scheme: light)'' and ''(not (prefers-color-scheme: light))''.
651+
649652
The method by which the user expresses their preference can vary.
650653
It might be a system-wide setting exposed by the Operating System,
651654
or a setting controlled by the User Agent.
@@ -660,6 +663,19 @@ Detecting the desire for light or dark color schemes: the 'prefers-color-scheme'
660663
so that 'prefers-color-scheme' reflects preferences appropriate to the medium
661664
rather than preferences taken out of context.
662665

666+
<div class=note>
667+
This feature, like the other 'prefers-*' features,
668+
previously had a <css>no-preference</css> value
669+
to indicate an author not expressing an active preference.
670+
However, user agents converged on expressing the "default" behavior
671+
as a ''light'' preference,
672+
and never matching <css>no-preference</css>.
673+
674+
If a future user agent wishes to expose a difference
675+
between "no preference" and "really wants a light display",
676+
please contact the CSSWG to discuss this.
677+
</div>
678+
663679
<h3 id="forced-colors">
664680
Detecting a forced color palette: the 'forced-colors' feature</h3>
665681

0 commit comments

Comments
 (0)