Skip to content

Commit 588ce61

Browse files
committed
[css-color-adjust-1] Rewrite color forcing section.
1 parent b34e72a commit 588ce61

File tree

1 file changed

+31
-26
lines changed

1 file changed

+31
-26
lines changed

css-color-adjust-1/Overview.bs

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,9 @@ Properties Affected by Forced Colors Mode {#forced-colors-properties}
330330

331331
When <a>forced colors mode</a> is active
332332
and 'forced-color-adjust' is ''forced-color-adjust/auto'' (see below) on an element,
333-
colors on the element must be force-adjusted to the user’s preferred color palette.
333+
colors on the element are force-adjusted to the user’s preferred color palette.
334334

335-
For each of the following properties:
335+
Specifically, for each of the following properties:
336336

337337
<ul>
338338
<li>'color'
@@ -345,31 +345,36 @@ Properties Affected by Forced Colors Mode {#forced-colors-properties}
345345
<li>'column-rule-color'
346346
<li>'scrollbar-color'
347347
<li>'-webkit-tap-highlight-color'
348-
</pre>
348+
<li>'background-color'
349+
</ul>
349350

350-
if the [=computed value=] would be a color other than a [=system color=],
351-
it must instead compute to an appropriate [=system color=],
352-
as chosen by the user agent.
353-
354-
For this purpose, any color value with the capability of "fallback" to another color,
355-
such as the ''color()'' function,
356-
must be allowed to fall back to a system color if specified.
357-
358-
The "appropriate system color" for 'background-color'
359-
must be matched to 'color':
360-
if 'color' is a [=system color=],
361-
'background-color' must be the opposite color
362-
from the [=system color pairings=]
363-
(taking ''canvastext'' if 'color' is ''canvas'',
364-
and ''canvas'' if 'color' is ''graytext'').
365-
It must also take its alpha channel from the original 'background-color' [=computed value=].
366-
367-
Additionally, 'box-shadow' and 'text-shadow' must be reset to ''box-shadow/none''.
368-
'background-image' is reset to ''background-image/none'' unless the original value is a ''url()'' function.
369-
370-
'color-scheme' on the element must compute to ''light dark'',
371-
to allow the user preference (see [[#forced|above]])
372-
to be respected.
351+
if its [=computed value=] would be a color other than a [=system color=],
352+
it is instead forced to a [=system color=] as follows:
353+
354+
* If the color value indicates a “fallback” color
355+
(as in the ''color()'' function in [[CSS-COLOR-5]])
356+
and that fallback color is a [=system color=],
357+
then the color is forced to that [=system color=].
358+
* Else for 'background-color' in particular,
359+
it is forced to
360+
the color opposite the 'color' property’s [=system color=] value
361+
in the [=system color pairings=],
362+
using ''CanvasText'' as the opposite of ''Canvas''.
363+
However, its alpha channel is taken from
364+
the original 'background-color' value
365+
so that transparent backgrounds remain transparent.
366+
* In all other cases, the UA determines
367+
the appropriate forced [=system color=]--
368+
which should match the color that would result
369+
from an empty [=author style sheet=]
370+
whenever all of the element’s affected properties
371+
are likewise UA-determined.
372+
373+
Additionally:
374+
* 'box-shadow' and 'text-shadow' compute to to ''box-shadow/none''
375+
* 'background-image' computes to ''background-image/none''
376+
unless the original value contains a ''url()'' function
377+
* 'color-scheme' computes to ''light dark''
373378

374379
UAs may further tweak these <a>forced colors mode</a> heuristics
375380
to provide better user experience.

0 commit comments

Comments
 (0)