Skip to content

Commit 670366f

Browse files
LeaVeroufantasai
andcommitted
[css-color-6] Rewrite serialization section for contrast-color()
Co-Authored-By: fantasai <725717+fantasai@users.noreply.github.com>
1 parent b860b74 commit 670366f

File tree

1 file changed

+8
-67
lines changed

1 file changed

+8
-67
lines changed

css-color-6/Overview.bs

+8-67
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,6 @@ If no target contrast is specified</h4>
283283

284284

285285

286-
287-
288286
<!--
289287
████████ ████████ ██████ ███████ ██ ██ ██ ████████
290288
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
@@ -306,8 +304,7 @@ If no target contrast is specified</h4>
306304
resolved according to [[css-color-4#resolving-color-values]].
307305
Otherwise (if ''currentColor'' was used in the function),
308306
the computed value is the ''contrast-color()'' function
309-
with each <<color>> parameter resolved according to [[css-color-4#resolving-color-values]],
310-
and the keywords ''AA'', ''AA-large'', ''AAA'', ''AAA-large'' replaced with their corresponding numeric value,
307+
with each component [=computed|computed value=],
311308
thus preserving inheritance into child elements.
312309

313310
<div class="example">
@@ -365,79 +362,23 @@ to add serialization of the
365362
results of the
366363
''contrast-color()'' function.
367364

368-
In this section, the strings used in the specification and the corresponding characters are as follows.
369-
370-
<table class="data">
371-
<tr>
372-
<th>String</th>
373-
<th>Character</th>
374-
</tr>
375-
<tr>
376-
<td>" "</td>
377-
<td>U+0020 SPACE</td>
378-
</tr>
379-
<tr>
380-
<td>","</td>
381-
<td>U+002C COMMA</td>
382-
</tr>
383-
<tr>
384-
<td>"-"</td>
385-
<td>U+002D HYPHEN-MINUS</td>
386-
</tr>
387-
<tr>
388-
<td>"."</td>
389-
<td>U+002E FULL STOP</td>
390-
</tr>
391-
<tr>
392-
<td>"/"</td>
393-
<td>U+002F SOLIDUS</td>
394-
</tr>
395-
</table>
396-
397-
The string "." shall be used as a decimal separator,
398-
regardless of locale,
399-
and there shall be no thousands separator.
400-
401-
As usual,
402-
if the alpha of the result is exactly 1,
403-
it is omitted from the serialization;
404-
an implicit value of 1 (fully opaque) is the default.
405-
406365
Serializing contrast-color() {#serial-contrast-color}
407366
-----------------------------------------------------
408367

409-
The serialization of the result of a ''contrast-color()'' function
410-
is a <<color>>,
411-
as defined in [[css-color-4#serializing-color-values]].
412-
The form used
413-
is the same as that used to specify
414-
the winning color.
368+
The [=specified value=] of the ''contrast-color()'' function
369+
is serialized with each keyword value as specified
370+
and each component in canonical order.
371+
372+
The [=resolved value=] of the ''contrast-color()'' function
373+
is the [=used color=] serialized the same as any other <<color>>.
415374

416375
<!--
417376
<wpt>
418377
parsing/color-contrast-computed.html
419378
</wpt>
420379
-->
421380

422-
The <em>minimum</em> precision for round-tripping
423-
is the same as that specified in
424-
[[css-color-4#serializing-color-values]].
425-
426-
<div class="example">
427-
The winner of this contrast choice
428-
<pre>contrast-color(wheat tbd-bg wcag2, olive, sienna, maroon)</pre>
429-
is maroon,
430-
so the result is serialized as
431-
<span class="swatch" style="--color: maroon"></span>
432-
"rgb(128 0 0)".
433-
434-
While the winner of
435-
<pre>contrast-color(wheat tbd-bg wcag2, color(prophoto-rgb 0.4 0.4 0.2), color(display-p3 0.45 0.08 0.05))</pre>
436-
is color(display-p3 0.45 0.08 0.05),
437-
so the result is serialized as
438-
<span class="swatch" style="--color: rgb(49.277% 0.414% 0.524%)"></span>
439-
"color(display-p3 0.45 0.08 0.05)".
440-
</div>
381+
441382

442383
<!--
443384
██████ ████████ ██████ ██ ██ ████████ ████ ████████ ██ ██

0 commit comments

Comments
 (0)