Skip to content

Commit 45812cb

Browse files
committed
[css-color-4] Split color conversion into two stages, #10211
1 parent c5b864c commit 45812cb

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

css-color-4/Overview.bs

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4699,7 +4699,7 @@ Simple Alpha Compositing</h3>
46994699
<h2 id="color-conversion" algorithm="to convert a color">
47004700
Converting Colors</h2>
47014701

4702-
<wpt title="This section provides an algorithm used later, it does not need tests."></wpt>
4702+
<wpt title="This section provides algorithms used later, it does not need tests."></wpt>
47034703

47044704
Colors may be converted
47054705
from one color space to another and,
@@ -4709,17 +4709,28 @@ and that each color space can represent out of gamut colors,
47094709
then (subject to numerical precision and round-off error)
47104710
the two colors will look the same and represent the same color sensation.
47114711

4712-
To convert a color |col1| in a source color space |src|
4713-
with white point |src-white|
4714-
to a color |col2| in destination color space |dest|
4715-
with white point |dest-white|:
4712+
<div algorithm>
4713+
To <dfn export>prepare a color |col1| for conversion</dfn>:
47164714

47174715
<ol>
4716+
<li id="powerless-to-missing">Change any [=powerless component=]s in |src| to [=missing component=]s</li>
47184717
<li id="convert-polrect">If |src| is in a <a>cylindrical polar color</a> representation,
4719-
first convert |col1|
4718+
convert |col1|
47204719
to the corresponding <a>rectangular orthogonal color</a> representation
47214720
and let this be the new |col1|.
4722-
4721+
</ol>
4722+
</div>
4723+
4724+
<div algorithm>
4725+
To <dfn export>convert a color</dfn> |col1| in a source color space |src|
4726+
with white point |src-white|
4727+
to a color |col2| in destination color space |dest|
4728+
with white point |dest-white|,
4729+
where |src| and |dest| are <em>different</em>:
4730+
4731+
<ol>
4732+
<li>prepare |col1| for conversion</li>
4733+
47234734
<li id="convert-missing">Replace any [=missing component=] with zero.</li>
47244735

47254736
<li id="convert-tolinear">If |src| is not a linear-light representation,
@@ -4756,6 +4767,7 @@ with white point |dest-white|:
47564767
convert from |dest-rect| to |dest|, and let this be |col2|.
47574768
This may produce [=missing component=]s.
47584769
</ol>
4770+
</div>
47594771

47604772

47614773
<!--
@@ -7838,7 +7850,10 @@ Changes</h2>
78387850
<a href="https://un5gmtkzgkj46tygt32g.julianrbryant.com/TR/2025/CRD-css-color-4-20250424/">Candidate Recommendation Draft of 24 April 2025</a></h3>
78397851

78407852
<ul>
7841-
<!-- to 26 March 2026 -->
7853+
<!-- to 31 March 2026 -->
7854+
<li>Split color conversion into two stages
7855+
(<a href="https://github.com/w3c/csswg-drafts/issues/10211">Issue 10211</a>)
7856+
</li>
78427857
<li>Clarified how system colors react to the used color scheme
78437858
(<a href="https://github.com/w3c/csswg-drafts/issues/13719">Issue 13719</a>)</li>
78447859
<li>Updated abstract to mention color interpolation and gamut mapping.</li>

0 commit comments

Comments
 (0)