Skip to content

Commit 4dacf26

Browse files
authored
Merge pull request #5540 from lilles/rune/move-color-scheme-meta
2 parents ff4d0c3 + 8f47ae4 commit 4dacf26

File tree

1 file changed

+5
-41
lines changed

1 file changed

+5
-41
lines changed

css-color-adjust-1/Overview.bs

+5-41
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,11 @@ Opting Into a Preferred Color Scheme: the 'color-scheme' property {#color-scheme
225225
To ensure particular foreground or background colors,
226226
they need to be specified explicitly.
227227

228+
Note: [[HTML]] specifies a
229+
<a href="https://html.spec.whatwg.org/multipage/semantics.html#meta-color-scheme">color-scheme</a>
230+
<{meta}> tag which can be used to set the color-scheme on the root element as
231+
a [[css-cascade-4#preshint|non-CSS presentational hint]].
232+
228233
Note: Earlier versions of this property also defined an <css>only</css> keyword
229234
to be specified alongside a preferred color scheme,
230235
indicating a stronger author preference.
@@ -260,47 +265,6 @@ Effects of the Used Color Scheme {#color-scheme-effect}
260265
via elements intended for graphics
261266
(such as <{img}> elements embedding an SVG document).
262267

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-
304268

305269
Forced Color Schemes: the 'forced-color-adjust' property {#forced}
306270
====================

0 commit comments

Comments
 (0)