Skip to content

Commit ab0d8e9

Browse files
committed
[css-color-4] Add example of carried forward alpha for premultiplication, fix #7536
1 parent b23e298 commit ab0d8e9

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

css-color-4/Overview.bs

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4536,14 +4536,34 @@ Interpolating with Missing Components</h3>
45364536
</pre>
45374537
</div>
45384538

4539+
If the carried forward [=missing component=]
4540+
is alpha, the color must be premultiplied with this carried forward value,
4541+
not with the zero value that would have resulted from color conversion.
4542+
4543+
<div class="example" id="ex-oklch-missing-alpha">
4544+
For example, if these two colors are interpolated,
4545+
the second of which has a missing alpha:
4546+
4547+
<pre>
4548+
<span class="swatch" style="--color: rgb(86.6% 62.7% 86.7% / 0.5)"></span> oklch(0.783 0.108 326.5 / 0.5)
4549+
<span class="swatch" style="--color: rgb(48.4% 0% 22.8% / 0)"></span> oklch(0.392 0.4 0 / none)
4550+
</pre>
4551+
4552+
Then the actual colors to be interpolated are
4553+
4554+
<pre>
4555+
<span class="swatch" style="--color: rgb(86.6% 62.7% 86.7% / 0.5)"></span> oklch(78.3% 0.108 326.5 / 0.5)
4556+
<span class="swatch" style="--color: rgb(48.4% 0% 22.8% / 0.5)"></span> oklch(39.2% 0.4 0 / 0.5)
4557+
</pre>
4558+
4559+
giving the premultiplied Oklch values [0.3915, 0.054, 326] and [0.196, 0.2, 0].
4560+
</div>
4561+
45394562
If both colors are [=missing=]
45404563
a given component,
45414564
the interpolated color
45424565
will also be [=missing=] that component.
45434566

4544-
<wpt>
4545-
4546-
</wpt>
45474567

45484568
<h3 id="interpolation-alpha">
45494569
Interpolating with Alpha</h3>

0 commit comments

Comments
 (0)