Skip to content

Commit a4d5117

Browse files
committed
[css-color-hdr] Added example color-mix() with three colors
1 parent a2eb085 commit a4d5117

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

css-color-5/Overview.bs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,23 @@ Otherwise, use the specified colorspace for mixing.
438438
<span class="swatch" style="--color: transparent"></span> oklch(0% 0 none / 0)
439439
</div>
440440

441+
<div class="example" id="ex-mix-three-no-percents">
442+
In this example three colors are mixed,
443+
and no percentages are given
444+
so each color contributes one-third of the final result.
445+
446+
<pre class="lang-css">color-mix(in oklab, teal, olive, blue);</pre>
447+
448+
The calculation is as follows:
449+
* <span class="swatch" style="--color: teal"></span> teal (#008080) is oklab(54.31% -0.0896 -0.0236)
450+
* <span class="swatch" style="--color: olive"></span> olive (#808000) is oklab(58.07% -0.0428 0.1191)
451+
* <span class="swatch" style="--color: blue"></span> blue (#0000FF) is oklab(45.20% -0.0325 -0.3115)
452+
* mixed lightness is (54.31 + 58.07 + 45.20) / 3 = 52.53%
453+
* mixed a is (-0.0896 + -0.0428 + -0.0325) / 3 = -0.0550
454+
* mixed b is (-0.0236 + 0.1191 + -0.3115) / 3 = -0.0720
455+
* mixed result is <span class="swatch" style="--color: rgb(15.62% 45.07% 58.8%)"></span> oklab(52.53% -0.0550 -0.0720)
456+
</div>
457+
441458
<h3 id="color-mix-color-space-effect">
442459
Effect of Mixing Color Space on color-mix
443460
</h3>
@@ -3706,7 +3723,7 @@ This specification adds a way to ensure adequate contrast for text whose backgro
37063723
</h3>
37073724

37083725
<ul>
3709-
<li><i>none</i></li>
3726+
<li>Added a color-mix() example with three colors, now that it is no longer restricted to just two.</li>
37103727
</ul>
37113728

37123729
<h3 id="changes-20250318">

0 commit comments

Comments
 (0)