Skip to content

Commit 69f7311

Browse files
committed
[css-color-4] more clarity on computed values
1 parent 2aa1baf commit 69f7311

1 file changed

Lines changed: 34 additions & 1 deletion

File tree

css-color-4/Overview.bs

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,17 +422,43 @@ Resolving <<color>> Values</h3>
422422
: [=named colors=]
423423
::
424424
The computed and used value
425-
is the corresponding sRGB color
425+
is the corresponding sRGB color,
426+
(for compatibility, in <<number>> form, not <<percentage>>)
426427
paired with the specified alpha channel
427428
(defaulting to opaque if unspecified).
428429

430+
Note: contrary to CSS Color 3,
431+
the parameters of the ''rgb()'' function
432+
are of type <<number>> not <<integer>>.
433+
For compatibility, numbers are still
434+
in the range [0-255];
435+
higher precision is indicated with any fractional part.
436+
437+
<div class="example">
438+
<p>
439+
For example,</p>
440+
<pre class="lang-css"><span class="swatch" style="--color: rgb(57.28% 42.14% 51.46%)"></span> rgb(146.064 107.457 131.223)</pre>
441+
<p>is now valid, and equal to</p>
442+
<pre class="lang-css"><span class="swatch" style="--color: rgb(57.28% 42.14% 51.46%)"></span> rgb(57.28% 42.14% 51.46%)</pre>
443+
444+
<!-- required precision?
445+
sRGB should accomodate at least 10 bits/component -->
446+
</div>
447+
429448
: ''lab()'' and ''lch()'' values
430449
::
431450
The computed and used value
432451
is the corresponding CIE Lab color
433452
paired with the specified alpha channel
434453
(defaulting to opaque if unspecified).
435454

455+
<div class="example">
456+
<p>For example, </p>
457+
<pre class="lang-css"><span class="swatch" style="--color: rgb(77.61% 36.34% 2.45%)"></span> lch(52.2345% 72.2 56.2 / 1)</pre>
458+
<p>would serialize as the string </p>
459+
<pre class="lang-css"><span class="swatch" style="--color: rgb(77.61% 36.34% 2.45%)"></span> "lab(52.2345% 40.1645 59.9971)"</pre>
460+
</div>
461+
436462

437463
: ''color()'' values
438464
::
@@ -441,6 +467,13 @@ Resolving <<color>> Values</h3>
441467
paired with the specified alpha channel
442468
(defaulting to opaque if unspecified).
443469

470+
<div class="example">
471+
<p>For example,</p>
472+
<pre class="lang-css"><span class="swatch" style="--color: goldenrod"></span> color(display-p3 0.823 0.6554 0.2537)</pre>
473+
<p>would serialize as the string</p>
474+
<pre class="lang-css"><span class="swatch" style="--color: goldenrod"></span> "color(display-p3 0.823 0.6554 0.2537)"</pre>
475+
</div>
476+
444477
: ''device-cmyk()'' values
445478
::
446479
The computed and used value

0 commit comments

Comments
 (0)