@@ -36,52 +36,55 @@ Preferred Color Schemes {#preferred}
36
36
=======================
37
37
38
38
Operating systems and user agents often give users
39
- the ability to choose their preferred color schemes
39
+ the ability to choose their preferred <dfn> color schemes</dfn>
40
40
for user interface elements.
41
41
These are typically reflected in the user agent's rendering
42
42
of its navigation interface as well as in-page interface elements
43
43
such as form controls and scrollbars,
44
44
and are expected to also be reflected
45
45
in the values of the CSS system colors.
46
46
47
- Users on some systems can also indicate a preference
48
- in the color scheme of the pages they view,
47
+ A UA can also allow the user to indicate a preference
48
+ for the [= color scheme=] of the pages they view,
49
49
requesting that the author adapt the page to those color preferences.
50
50
(It is not required to express a preference;
51
51
users can have preferences for operating system interface colors
52
52
that they do not want imposed on pages.)
53
+
53
54
The most common preferences
54
55
are a choice of “Light” vs “Dark” (or “Day Mode” vs “Night Mode”) color schemes,
55
56
rendering things as mostly light- or dark-colored backgrounds,
56
57
and with dark- or light-colored foregrounds (text, icons).
57
58
This module,
58
- together with Media Queries Level 5,
59
- defines controls to enable color scheme negotiation
60
- for "light" and "dark" color schemes (and no preference).
59
+ together with <a href="https://www.w3.org/TR/mediaqueries-5/"> Media Queries Level 5</a> ,
60
+ defines controls to enable [= color scheme=] negotiation
61
+ for “Light” and “Dark” [= color schemes=] (and no preference).
61
62
62
- To enable pages to adapt to the user's preferred color scheme,
63
+ To enable pages to adapt to the user's preferred [= color scheme=] ,
63
64
user agents will match the '@media/prefers-color-scheme' media query
64
- to the user's preferred color scheme .
65
- <!-- See [[MEDIAQUERIES-5]] . -->
65
+ to the user's preferred [= color schemes=] .
66
+ See [[MEDIAQUERIES-5]] .
66
67
67
- Additionally, if the author has indicated that the page can support this color scheme
68
+ Additionally, if the author has indicated that the page can support this [= color scheme=]
68
69
(see 'color-scheme' ),
69
- the user agent must match the following to the user's preferred color scheme:
70
+ the user agent must match the following to the user's preferred [= color scheme=] :
70
71
71
- * the initial color of the background canvas <span class=issue> find what we name this in other specs</span> ,
72
+ * the initial color of the <a href="https://www.w3.org/TR/CSS2/intro.html#canvas">canvas</a>
73
+ <span class=issue> find what we name this in other specs</span> ,
72
74
the initial value of the '/color' property,
73
75
and the [[css-color-4#css-system-colors|system colors]]
74
76
* the default colors of scrollbars and other interaction UI
75
77
* the default colors of form controls and other "specially-rendered" elements
76
78
* the default colors of other browser-provided UI, such as "spellcheck" underlines
77
79
78
- User agents <em> may</em> support additional color schemes,
79
- however CSS does not support negotiation of additional color schemes:
80
+ User agents <em> may</em> support additional [= color schemes=] ,
81
+ however CSS does not support negotiation of additional [= color schemes=] :
80
82
user agents should pursue standardization of these schemes,
81
83
so that '@media/prefers-color-scheme' and 'color-scheme' can reflect the additional values.
82
84
83
85
Note: Aside from the small list of adjustments given above,
84
- user agents generally do not further adjust a page to match the user's preferred color scheme,
86
+ user agents generally do not further adjust a page
87
+ to match the user's preferred [=color scheme=] ,
85
88
because the chance of accidentally ruining a page is too high.
86
89
However, when particular color choices are required by the user
87
90
(for accessibility reasons, for example),
@@ -101,25 +104,25 @@ Opting Into a Preferred Color Scheme: the 'color-scheme' property {#color-scheme
101
104
</pre>
102
105
103
106
The 'color-scheme' property allows an element to indicate
104
- which color schemes it is comfortable being rendered with.
107
+ which [= color schemes=] it is comfortable being rendered with.
105
108
These values are negotiated with the users preferences,
106
- resulting in a chosen color scheme
109
+ resulting in a chosen [= color scheme=]
107
110
that affects UI things such as
108
111
the default colors of form controls and scrollbars
109
112
as well as the used values of the CSS system colors.
110
113
Its values are defined as follows:
111
114
112
115
<dl dfn-type=value dfn-for=color-scheme>
113
116
: <dfn>normal</dfn>
114
- :: Indicates that the element isn't aware of color schemes at all,
115
- and so the element should be rendered with the browser's default color scheme.
117
+ :: Indicates that the element isn't aware of [= color schemes=] at all,
118
+ and so the element should be rendered with the browser's default [= color scheme=] .
116
119
117
120
: <dfn lt="light | dark">[ light | dark | <<custom-ident>> ]+</dfn>
118
- :: Indicates that the element is aware of and can handle the listed color schemes,
121
+ :: Indicates that the element is aware of and can handle the listed [= color schemes=] ,
119
122
and expresses an ordered preference between them.
120
123
(See [[#color-scheme-processing]] for details on how this choice is resolved.)
121
124
122
- ''light'' represents a "light" color scheme,
125
+ ''light'' represents a “Light” [= color scheme=] ,
123
126
with light background colors and dark foreground colors.
124
127
''dark'' represents the opposite,
125
128
with dark background colors and light foreground colors.
@@ -137,7 +140,7 @@ Opting Into a Preferred Color Scheme: the 'color-scheme' property {#color-scheme
137
140
must be explicitly added to this property’s grammar.
138
141
To avoid confusion,
139
142
authoring tutorials and references
140
- should omit it from their materials.
143
+ should omit <<custom-ident>> from their materials.
141
144
142
145
''only'' , ''color-scheme/normal'' , ''light'' , and ''dark'' are not valid <<custom-ident>> s in this property.
143
146
@@ -147,9 +150,9 @@ Opting Into a Preferred Color Scheme: the 'color-scheme' property {#color-scheme
147
150
148
151
: <dfn lt=only>only</dfn>
149
152
:: If provided,
150
- ''only'' indicates that the element <em> must</em> be rendered with one of the specified color schemes,
153
+ ''only'' indicates that the element <em> must</em> be rendered with one of the specified [= color schemes=] ,
151
154
if possible,
152
- even if the user's preference is for a different color scheme.
155
+ even if the user's preference is for a different [= color scheme=] .
153
156
154
157
Issue: Per spec, ''only'' can only be used with ''light'' .
155
158
Apple's implementation allows it with ''dark'' as well.
@@ -159,21 +162,21 @@ Opting Into a Preferred Color Scheme: the 'color-scheme' property {#color-scheme
159
162
depending on further consideration.
160
163
161
164
Authors <strong> should not</strong> use this value,
162
- and should instead ensure that their page renders well with whatever color scheme the user prefers
165
+ and should instead ensure that their page renders well with whatever [= color scheme=] the user prefers
163
166
(using the '@media/prefers-color-scheme' media query to adjust styles accordingly).
164
167
This keyword is provided only for the rare cases where that might not be reasonably possible,
165
168
and using a different color scheme would render the element difficult or impossible to use.
166
169
167
- Note that user agents are <strong> not required</strong>
168
- to support any particular color scheme,
169
- so using ''only'' to indicate a required color scheme
170
+ Note: User agents are <strong> not required</strong>
171
+ to support any particular [= color scheme=] ,
172
+ so using ''only'' to indicate a required [= color scheme=]
170
173
is still not guaranteed to have any effect on the rendering of the element.
171
174
</dl>
172
175
173
176
Note: “Light” and “Dark” modes are not specific color palettes.
174
177
For example,
175
178
both a stark black-on-white scheme and a sepia dark-on-tan scheme
176
- would be considered “Light” color schemes.
179
+ would both be considered “Light” color schemes.
177
180
To ensure particular foreground or background colors,
178
181
they need to be specified explicitly.
179
182
@@ -191,7 +194,7 @@ Finding the Used Color Scheme {#color-scheme-processing}
191
194
192
195
3. If the computed value of 'color-scheme' on |el| contains the ''only'' keyword
193
196
or |scheme| is <css> no-preference</css> ,
194
- and at least one color scheme indicated in 'color-scheme'
197
+ and at least one [= color scheme=] indicated in 'color-scheme'
195
198
is supported by the user agent,
196
199
return the first keyword,
197
200
in specified order,
@@ -203,13 +206,13 @@ Finding the Used Color Scheme {#color-scheme-processing}
203
206
For each element,
204
207
find the [=used color scheme=] for that element.
205
208
If the [=used color scheme=] is <css> no-preference</css> ,
206
- the element must be rendered with the user agent's default color scheme.
207
- (For Web compatibility, this should be a "light" color scheme.)
209
+ the element must be rendered with the user agent's default [= color scheme=] .
210
+ (For Web compatibility, this should be a “Light” [= color scheme=] .)
208
211
Otherwise,
209
212
the element must be rendered with the [=used color scheme=] .
210
213
211
214
Note: This algorithm ensures that
212
- if the user prefers a non-default color scheme,
215
+ if the user prefers a non-default [= color scheme=] ,
213
216
it will only be used if the page claims to support it.
214
217
This ensures that legacy pages,
215
218
written before color scheme preferences were exposed,
@@ -219,12 +222,12 @@ Effects of the Used Color Scheme {#color-scheme-effect}
219
222
--------------------------------
220
223
221
224
For all elements,
222
- rendering with a color scheme should cause the colors used in all browser-provided UI for the element--
225
+ rendering with a [= color scheme=] should cause the colors used in all browser-provided UI for the element--
223
226
e.g. scrollbars, spellcheck underlines, form controls, etc.--
224
- to match with the intent of the color scheme.
227
+ to match with the intent of the [= color scheme=] .
225
228
226
229
On the root element,
227
- rendering with a color scheme additionally must affect the background of the canvas,
230
+ rendering with a [= color scheme=] additionally must affect the background of the canvas,
228
231
the initial value of the '/color' property,
229
232
and the used values of the [[css-color-4#css-system-colors|system colors]] ,
230
233
and should also affect the viewport's scrollbars.
@@ -245,7 +248,7 @@ Effects of the Used Color Scheme {#color-scheme-effect}
245
248
The "color-scheme" <{meta}> value {#color-scheme-meta}
246
249
---------------------------------
247
250
248
- To aid user agents in rendering the page background with the desired color scheme immediately
251
+ To aid user agents in rendering the page background with the desired [= color scheme=] immediately
249
252
(rather than waiting for all CSS in the page to load),
250
253
a 'color-scheme' value can also be provided in a <{meta}> element.
251
254
0 commit comments