Skip to content

Commit 1951a08

Browse files
committed
[css-color-4] more examples of specified value
1 parent 69f7311 commit 1951a08

File tree

1 file changed

+34
-4
lines changed

1 file changed

+34
-4
lines changed

css-color-4/Overview.bs

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,8 @@ Resolving <<color>> Values</h3>
425425
is the corresponding sRGB color,
426426
(for compatibility, in <<number>> form, not <<percentage>>)
427427
paired with the specified alpha channel
428-
(defaulting to opaque if unspecified).
428+
(as a <<number>>, not a <<percentage>>;
429+
and defaulting to opaque if unspecified).
429430

430431
Note: contrary to CSS Color 3,
431432
the parameters of the ''rgb()'' function
@@ -434,12 +435,22 @@ Resolving <<color>> Values</h3>
434435
in the range [0-255];
435436
higher precision is indicated with any fractional part.
436437

438+
Trailing zeroes in any component values must be suppressed;
439+
if the fractional part consists of all zeroes,
440+
the decimal point must also be suppressed.
441+
This means that sRGB colors specified with integer component values
442+
will serialize with backwards-compatible integer values.
443+
437444
<div class="example">
438445
<p>
439446
For example,</p>
440447
<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>
441448
<p>is now valid, and equal to</p>
442449
<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>
450+
<p>while ''goldenrod'' will serialize as</p>
451+
<pre class="lang-css"><span class="swatch" style="--color: goldenrod"></span> "rgb(218 165 32)"</pre>
452+
<p>and not</p>
453+
<pre class="lang-css"><span class="swatch" style="--color: goldenrod"></span> "rgb(218.000 165.000 32.000)"</pre>
443454

444455
<!-- required precision?
445456
sRGB should accomodate at least 10 bits/component -->
@@ -450,7 +461,8 @@ Resolving <<color>> Values</h3>
450461
The computed and used value
451462
is the corresponding CIE Lab color
452463
paired with the specified alpha channel
453-
(defaulting to opaque if unspecified).
464+
(as a <<number>>, not a <<percentage>>;
465+
and defaulting to opaque if unspecified).
454466

455467
<div class="example">
456468
<p>For example, </p>
@@ -465,7 +477,8 @@ Resolving <<color>> Values</h3>
465477
The computed and used value
466478
is the color in the specified [=colorspace=],
467479
paired with the specified alpha channel
468-
(defaulting to opaque if unspecified).
480+
(as a <<number>>, not a <<percentage>>;
481+
and defaulting to opaque if unspecified).
469482

470483
<div class="example">
471484
<p>For example,</p>
@@ -478,8 +491,10 @@ Resolving <<color>> Values</h3>
478491
::
479492
The computed and used value
480493
is the specified device-specific CMYK color,
494+
(with components as <<number>>, not <<percentage>>)
481495
paired with the specified alpha channel
482-
(defaulting to opaque if unspecified).
496+
(as a <<number>>, not a <<percentage>>;
497+
and defaulting to opaque if unspecified).
483498

484499
The [=actual value=] can vary based on the operation;
485500
for rendering to a CMYK-capable device,
@@ -489,6 +504,21 @@ Resolving <<color>> Values</h3>
489504
it must be converted
490505
as specified in [[#device-cmyk]].
491506

507+
<div class="example">
508+
<p>For example, </p>
509+
<pre class="lang-css"><span class="swatch" style="--color: rgb(93.124%, 44.098%, 57.491%)"></span> device-cmyk(0% 70% 20% 0%)</pre>
510+
<p>
511+
has the specified and actual value
512+
</p>
513+
<pre class="lang-css"><span class="swatch" style="--color: rgb(93.124%, 44.098%, 57.491%)"></span> device-cmyk(0 0.7 0.2 0)</pre>
514+
<p>
515+
and will, if the implementation understands ICC profiles
516+
and has the recommeneded profile installed,
517+
have the used value
518+
</p>
519+
<pre class="lang-css"><span class="swatch" style="--color: rgb(93.124%, 44.098%, 57.491%)"></span> lab(63.673% 51.577 5.811)</pre>
520+
</div>
521+
492522
: [=system colors=]
493523
::
494524
Each <<system-color>> keyword computes to itself.

0 commit comments

Comments
 (0)