Skip to content

Commit fa0da5c

Browse files
committed
[css-color-5] Fix computed vs used with currentColor per WG minutes, see #7302
1 parent b20f5d5 commit fa0da5c

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

css-color-5/Overview.bs

+25-7
Original file line numberDiff line numberDiff line change
@@ -2376,18 +2376,36 @@ or any other color or monochrome output device which has been characterized.
23762376

23772377
<h3 id="resolving-contrast">Resolving ''color-contrast()'' values</h3>
23782378

2379-
The computed value is the specified ''color-contrast()'' function
2379+
The specified value is the ''color-contrast()'' function
23802380
with each <<color>> parameter resolved according to [[css-color-4#resolving-color-values]],
23812381
and the keywords ''AA'', ''AA-large'', ''AAA'', ''AAA-large'' replaced with their corresponding numeric value.
23822382

23832383
If all <<color>> parameters resolve
23842384
to the corresponding colors in their respective color spaces,
2385-
the used value is the winning color
2385+
the computed value is the winning color
23862386
resolved according to [[css-color-4#resolving-color-values]].
23872387
Otherwise (if ''currentColor'' was used in the function),
2388-
the used value is the same as the computed value
2388+
the computed value is the same as the specified value,
23892389
thus preserving inheritance into child elements.
23902390

2391+
<div class="example">
2392+
For example, given the value
2393+
2394+
<pre class="lang-css">
2395+
color-contrast(rgb(179 213 230) vs cadetblue, hsl(200 83% 23%) to AA)
2396+
</pre>
2397+
2398+
the contrast with cadetblue is <strong>1.97</strong>
2399+
while the contrast with hsl(200 83% 23%) is <strong>6.09</strong>
2400+
which exceeds 4.5, the value for 'AA';
2401+
so it has the computed value of the resolved hsl function:
2402+
2403+
<pre class="lang-css">
2404+
rgb(10 75 107)
2405+
</pre>
2406+
2407+
</div>
2408+
23912409
<div class="example">
23922410

23932411
For example, given a current color value of
@@ -2398,7 +2416,7 @@ or any other color or monochrome output device which has been characterized.
23982416
color-contrast(currentColor vs hsl(200 83% 23%), purple to AA)
23992417
</pre>
24002418

2401-
has the computed and used value
2419+
has the computed value
24022420

24032421
<pre class="lang-css">
24042422
color-contrast(currentColor vs rgb(10 75 107), rgb(128 0 128) to 4.5)
@@ -2408,16 +2426,16 @@ or any other color or monochrome output device which has been characterized.
24082426

24092427
<h3 id="resolving-mix">Resolving ''color-mix()'' values</h3>
24102428

2411-
The computed value is the specified ''color-mix()'' function
2429+
The specified value is the ''color-mix()'' function
24122430
with each <<color>> parameter resolved according to [[css-color-4#resolving-color-values]].
24132431

24142432
If all <<color>> parameters resolve
24152433
to the corresponding colors in their respective color spaces,
2416-
the used value is the mixed color,
2434+
the computed value is the mixed color,
24172435
in the specified mixing color space,
24182436
resolved according to [[css-color-4#resolving-color-values]].
24192437
Otherwise (if ''currentColor'' was used in the function),
2420-
the used value is the same as the computed value
2438+
the computed value is the same as the specified value
24212439
thus preserving inheritance into child elements.
24222440

24232441

0 commit comments

Comments
 (0)