You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<h4 id="HTML-compatible-serialization-of-srgb">HTML-compatible serialization of sRGB values</h4>
6200
+
6201
+
If the following conditions are all true:
6202
+
6203
+
<ol>
6204
+
<li>The color space is sRGB</li>
6205
+
<li>The alpha is 1</li>
6206
+
<li>There are no [=missing=] values</li>
6207
+
<li>The RGB component values are internally represented as integers between 0 and 255 inclusive (i.e. 8-bit unsigned integer)</li>
6208
+
<li>HTMLCompatible serialization is requested</li>
6209
+
</ol>
6210
+
6211
+
Then corresponding sRGB values are serialized in 6-digit [=hex color notation=] as follows:
6212
+
6213
+
A seven-character string consisting of the character "#", followed immediately by the two-digit hexadecimal representations of the red component, the green component, and the blue component, in that order, using <a href="https://infra.spec.whatwg.org/#ascii-lower-hex-digit">ASCII lower hex digits</a>. No spaces are permitted.
6214
+
6215
+
<div class="example" id="ex-canvas-srgb">
6216
+
For example, the pixel value from a canvas 2D context
6217
+
using the sRGB colorspace is returned as a Uint8ClampedArray:
The color space is sRGB, the representation is 8 bits per component, the data format does not produce ''none'' values nor does it support extended range values, and the alpha is 1 (255/255).
6226
+
6227
+
The HTML-compatible serialization is the string "#25a457" (not "#25A457").
6228
+
</div>
6229
+
6230
+
Otherwise, for sRGB the <a href="#css-serialization-of-srgb">CSS serialization of sRGB values is used</a> and for other color spaces, the relevant <a href="#serializing-color-values">serialization</a> of the <<color>> value.
6231
+
6232
+
<div class="example" id="ex-canvas-p3">
6233
+
For example, the pixel value from a canvas 2D context,
6234
+
this time using the display-p3 colorspace is returned,
0 commit comments