Skip to content

Commit 2a9093b

Browse files
committed
[css-color-5] add lch vs oklch blue-white mix examle w3c#6642
1 parent 247efff commit 2a9093b

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

css-color-5/Overview.bs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,38 @@ The choice of mixing colorspace can have a large effect on the end result.
336336
* mix result is <span class="swatch" style="--color: rgb(72.300% 38.639% 53.557%)"></span> lch(53.0304% 38.9346, 352.8138) which is rgb(72.300% 38.639% 53.557%)
337337
</div>
338338

339+
<div class="example" id="ex-mix-blue-white">
340+
341+
<!--
342+
https://colorjs.io/notebook/?storage=https%3A%2F%2Fgist.github.com%2Fsvgeesus%2F7298c61254db05ec190c21f76ded6c7b
343+
-->
344+
345+
This example is a 50% mix of white and blue,
346+
in three different color spaces.
347+
348+
<pre class="lang-css">
349+
color-mix(in lch, white, blue);
350+
color-mix(in oklch, white, blue);
351+
color-mix(in srgb, white, blue);
352+
</pre>
353+
354+
The calcuation is as follows:
355+
* <span class="swatch" style="--color: white"></span> white
356+
is rgb(100% 100% 100%)
357+
which is lch(100% 0 none)
358+
which is oklch(100% 0 none)
359+
* <span class="swatch" style="--color: blue"></span> blue
360+
is rgb(0% 0% 100%)
361+
which is lch(29.5683% 131.201 301.364)
362+
which is oklch(45.201% 0.31332 264.059)
363+
* <span class="swatch" style="--color: rgb(68.594% 53.794% 100%)"></span> mix
364+
in lch is lch(64.7841% 65.6008 301.364) which is quite purple
365+
* <span class="swatch" style="--color: rgb(45.304% 63.808% 100%)"></span> mix
366+
in oklch is oklch(72.601 0.15672 264.059)
367+
* <span class="swatch" style="--color: rgb(50% 50% 100%)"></span> mix
368+
in srgb is rgb(50% 50% 100%) which is also a bit purple
369+
</div>
370+
339371
<!--
340372
Let's move this example to the appropriate section when we have the new syntax for making these low-level adjustments
341373
<div class="example">

0 commit comments

Comments
 (0)