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
{{ message }}
Repository navigation
Commit e733df9
Browse filesBrowse the repository at this point in the historyBrowse files
<wpt title="Actual values of color are not exposed to script, making this hard to test in an automated manner."></wpt>
6170
+
<wpt title="Actual values of color are not exposed to script, making this hard to test in an automated manner. A choice of three algorithms also makes this harder to test"></wpt>
6171
6171
6172
6172
The three <dfn export>CSS gamut mapping algorithms</dfn>
6173
6173
apply to
6174
6174
Standard Dynamic Range (SDR) CSS colors
6175
-
which are out of gamut
6176
-
of an RGB display
6177
-
and thus require to be <dfn export>css gamut mapped</dfn>.
6175
+
which are out of gamut of:
6176
+
6177
+
<ul>
6178
+
<li>an RGB display (which cannot represent out of gamut values in the frame buffer)</li>
6179
+
<li>a canvas, with <a href="https://html.spec.whatwg.org/multipage/canvas.html#dom-canvascolortype-unorm8">unorm8</a>
6180
+
backing store (thus, unable to store out of gamut values)</li>
6181
+
</ul>
6182
+
6183
+
They thus require to be <dfn export>css gamut mapped</dfn>.
6184
+
6185
+
<div class="example" id="ex-p3-oog-display">
6186
+
For example, given a Display P3 screen,
6187
+
attempting to display the color color(display-p3 1.1 0.4 0.2)
6188
+
will trigger gamut mapping,
6189
+
because the red coordinate is outside the range 0 to 1;
6190
+
gamut mapping will produce a similar, but lower chroma,
6191
+
color, such as <span class="swatch" style="--color: #ff764f"></span> color(display-p3 1 0.473 0.314).
6192
+
</div>
6193
+
6194
+
<div class="example" id="ex-p3-oog-canvas">
6195
+
For example, given a 2d context
6196
+
with colorSpace set to "display-p3"
6197
+
and colorType set to "unorm8";
6198
+
attempting to paint the color oklch(76% 0.27 60)
6199
+
will trigger gamut mapping,
6200
+
because once converted to Display P3,
6201
+
the value color(display-p3 1.062 0.4954 -0.3115)
6202
+
has a red coordinate greater than 1 and a negative blue coordinate.
6203
+
Gamut mapping will produce a similar, but lower chroma,
6204
+
color, such as <span class="swatch" style="--color: #ff8900"></span> color(display-p3 1 0.546 0).
6205
+
</div>
6178
6206
6179
6207
Implementations my choose any of the three algorithms
6180
6208
based on their quality and runtime efficiency tradeoffs,
0 commit comments