@@ -218,6 +218,10 @@ Opting Into a Preferred Color Scheme: the 'color-scheme' property {#color-scheme
218
218
affects what <<system-color>> s resolve to.
219
219
</div>
220
220
221
+ [[HTML]] specifies a <a href="https://html.spec.whatwg.org/multipage/semantics.html#meta-color-scheme">color-scheme</a>
222
+ <{meta}> tag which can be used to set the color-scheme on the root element as
223
+ a [[css-cascade-4#preshint|non-CSS presentational hint]] .
224
+
221
225
Note: “Light” and “dark” color schemes are not specific color palettes.
222
226
For example,
223
227
both a stark black-on-white scheme and a sepia dark-on-tan scheme
@@ -260,47 +264,6 @@ Effects of the Used Color Scheme {#color-scheme-effect}
260
264
via elements intended for graphics
261
265
(such as <{img}> elements embedding an SVG document).
262
266
263
- The "color-scheme" <{meta}> value {#color-scheme-meta}
264
- ---------------------------------
265
-
266
- To aid user agents in rendering the page background with the desired [=color scheme=] immediately
267
- (rather than waiting for all CSS in the page to load),
268
- a 'color-scheme' value can also be provided in a <{meta}> element.
269
-
270
- If any <{meta}> elements are [=inserted into a document=] or [=removed from a document=] ,
271
- or existing <{meta}> elements have their <{meta/name}> or <{meta/content}> attributes changed,
272
- user agents must run the following algorithm:
273
-
274
- <div algorithm="find the color-scheme meta">
275
- 1. Let |candidate elements| be the list of all <{meta}> elements that meet the following criteria,
276
- in [=tree order=] :
277
-
278
- * the element is [=in a document tree=]
279
- * the element has a <{meta/name}> attribute,
280
- whose value is an [=ASCII case-insensitive=] match for <code> color-scheme</code>
281
- * the element has a <{meta/content}> attribute,
282
- whose value is not the empty string
283
- * the element is a child of the [=the head element=] of the document
284
-
285
- 2. For each |element| in |candidate elements|:
286
- 1. If |element|’s <{meta/content}> attribute's value
287
- [=CSS/parses=] as a <'color-scheme' > value,
288
- treat that value as a declaration of the 'color-scheme' property on |element|’s [=tree/root=] ,
289
- cascaded as a [[css-cascade-4#preshint|non-CSS presentational hint]] .
290
- Then return.
291
-
292
- Note: Because these rules check successive elements until they find a match,
293
- an author can provide multiple such values
294
- to handle fallback for legacy user agents.
295
- Opposite how CSS fallback works for properties,
296
- the multiple <{meta}> elements must be arranged
297
- with the legacy values <em> after</em> the newer values.
298
- </div>
299
-
300
- Issue(#3846): This algorithm favors the first <{meta}> ,
301
- to allow for ASAP rendering with a chosen color scheme.
302
- Is that the desired behavior?
303
-
304
267
305
268
Forced Color Schemes: the 'forced-color-adjust' property {#forced}
306
269
====================
0 commit comments