@@ -747,6 +747,50 @@ This section updates and replaces that part of CSS Object Model, section
747747 <p> is the string "lab(56.2% 83.51 -3.79 / 0.93)"</p>
748748 </div>
749749
750+ <h4 id="serializing-color-values">Serializing values of the ''color()'' function</h4>
751+
752+ The serialized form of ''color()'' values
753+ is derived from the [=computed value=]
754+ and uses the ''color()'' form,
755+ with lowercase letters for the function name
756+ and the colorspace name.
757+
758+ The component values are serialized in base 10,
759+ as <<number>> .
760+ A single ASII space character " "
761+ must be used as the separator
762+ between the component values.
763+
764+ Trailing fractional zeroes in any component values must be omitted;
765+ if the fractional part consists of all zeroes,
766+ the decimal point must also be omitted.
767+
768+ <div class="example" id="ex-color-serial">
769+ <p> The serialized value of</p>
770+ <pre class="lang-css"><span class="swatch" style="--color: rgba(99.56%, 6.09%, 57.02%, 0.93)"></span> color(dIsPlAy-P3 0.964 0.763 0.787)</pre>
771+ <p> Is the string "color(display-p3 0.96 0.76 0.79)",
772+ if two decimal places are retained.
773+ Notice that 0.787 has rounded up to 0.79,
774+ rather than being truncated to 0.78.
775+ </p>
776+ </div>
777+
778+ If the colorspace is sRGB, the colorspace must be omitted in the serialized result.
779+ <!--
780+ could go either way on that but we need to pick one, and this is shorter
781+ -->
782+
783+ The precision with which ''color'' component values are retained,
784+ and thus the number of significant figures in the serialized value,
785+ is not defined in this specification,
786+ but for RGB and CMYK colorspaces must at least be sufficient
787+ to round-trip values
788+ with eight bit precision;
789+ this will result in at least two decimal places
790+ unless trailing zeroes have been omitted.
791+ (16bit, or half float, is recommended for internal storage).
792+ Values must be rounded, not truncated.
793+
750794<h2 id='numeric-srgb'>
751795sRGB Colors</h2>
752796
0 commit comments