Skip to content

Commit b90ecde

Browse files
committed
[css-color-4] minimum bits for serialization, closes #5667
1 parent ffcaf56 commit b90ecde

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

css-color-4/Overview.bs

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -844,12 +844,46 @@ and there shall be no thousands separator.
844844
The precision with which ''color()'' component values are retained,
845845
and thus the number of significant figures in the serialized value,
846846
is not defined in this specification,
847-
but for RGB and CMYK colorspaces must at least be sufficient
847+
but for sRGB and CMYK colorspaces must at least be sufficient
848848
to round-trip values
849849
with eight bit precision;
850850
this will result in at least two decimal places
851851
unless trailing zeroes have been omitted.
852-
(16bit, or half float, is recommended for internal storage).
852+
853+
For the predefined colorspaces other than sRGB,
854+
which have wider gamuts and thus require more bits to avoid banding,
855+
the minimum precision for round-tripping is as follows:
856+
857+
<table class="data">
858+
<tr><th>Colorspace</th><th>Minimum bits</th></tr>
859+
<tr>
860+
<td>''display-p3''</td>
861+
<td>10</td>
862+
</tr>
863+
<tr>
864+
<td>''a98-rgb''</td>
865+
<td>10</td>
866+
</tr>
867+
<tr>
868+
<td>''prophoto-rgb''</td>
869+
<td>12</td>
870+
</tr>
871+
<tr>
872+
<td>''rec2020''</td>
873+
<td>12</td>
874+
</tr>
875+
<tr>
876+
<td>''xyz''</td>
877+
<td>16</td>
878+
</tr>
879+
<tr>
880+
<td>''lab''</td>
881+
<td>16</td>
882+
</tr>
883+
</table>
884+
885+
(16bit, half-float, or float <em>per component</em>
886+
is recommended for internal storage).
853887
Values must be <a href="https://drafts.csswg.org/css-values-4/#combine-integers">rounded towards +∞</a>, not truncated.
854888

855889
<a href="#serializing-alpha-values">As noted earlier</a>,

0 commit comments

Comments
 (0)