Skip to content

Commit 3a7a00e

Browse files
committed
Use an entirely different example that doesn't go out of gamut.
1 parent b4387e0 commit 3a7a00e

File tree

2 files changed

+56
-60
lines changed

2 files changed

+56
-60
lines changed

css-color-5/Overview.bs

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -178,41 +178,37 @@ If no keyword is specified, it is as if ''shorter'' were specified.
178178
</div>
179179

180180
<div class="example">
181-
This example produces the mixture of red and yellow,
181+
This example produces the mixture of teal and olive,
182182
in ''lch'' colorspace (the default),
183-
with each lch channel being 65% of the value for red
184-
and 35% of the value for yellow.
183+
with each lch channel being 65% of the value for teal
184+
and 35% of the value for olive.
185185

186186
Note: interpolating on hue and chroma
187187
keeps the intermediate colors
188188
as saturated as the endpoint colors.
189189

190-
Note: Some of the intermediate colors (including the one shown)
191-
are outside of the sRGB gamut
192-
and may not display correctly across implementations.
193-
194-
<pre class="lang-css">color-mix(red yellow 65%);</pre>
190+
<pre class="lang-css">color-mix(teal olive 65%);</pre>
195191

196192
<figure>
197193
<img src="images/CH-mixing3.svg" style="width: 50vmin">
198-
<figcaption>Mixtures of red and yellow.
199-
Red has a hue angle, measured from the positive a axis,
200-
of 40.8526 degrees
201-
while yellow has a hue angle of 99.5746 degrees.
202-
Red has a chroma, or distance from the central neutral axis, of 106.8390
203-
while yellow has a chroma of 94.7077.
194+
<figcaption>Mixtures of teal and olive.
195+
Teal has a hue angle, measured from the positive a axis,
196+
of 196.4524 degrees
197+
while olive has a hue angle of 99.5746 degrees.
198+
Teal has a chroma, or distance from the central neutral axis, of 31.6903
199+
while olive has a chroma of 56.8124.
204200
Mixtures lie along the dashed curve. A 65%/35% mixture is shown.
205201
</figcaption>
206202
</figure>
207203

208204
The calculation is as follows:
209-
* sRGB <span class="swatch" style="--color: red"></span> red (#F00) is lch(54.2917% 106.8390 40.8526)
210-
* sRGB <span class="swatch" style="--color: yellow"></span> yellow (#FF0) is lch(97.6071% 94.7077 99.5746)
211-
* mixed lightness is 54.2917 * 0.65 + 97.6071 * 0.35 = 69.4521
212-
* mixed chroma is 106.8390 * 0.65 + 94.7077 * 0.35 = 102.5930
213-
* mixed hue is 40.8526 * 0.65 + 99.5746 * 0.35 = 61.4053
214-
* mixed result is lch(69.4521% 102.5930 61.4053)
215-
* which is a red-orange: <span class="swatch" style="--color: rgb(104.3765% 50.3695% -30.9644%)"></span> rgb(104.3765% 50.3695% -30.9644%)
205+
* sRGB <span class="swatch" style="--color: teal"></span> teal (#008080) is lch(47.9855% 31.6903 196.4524)
206+
* sRGB <span class="swatch" style="--color: olive"></span> olive (#808000) is lch(52.1496% 56.8124 99.5746)
207+
* mixed lightness is 47.9855 * 0.65 + 52.1496 * 0.35 = 49.4429
208+
* mixed chroma is 31.6903 * 0.65 + 56.8124 * 0.35 = 40.4830
209+
* mixed hue is 196.4524 * 0.65 + 99.5746 * 0.35 = 162.5452
210+
* mixed result is lch(49.4429% 40.4830 162.5452)
211+
* which is a slightly-blueish green: <span class="swatch" style="--color: rgb(7.7377% 52.5730% 37.3213%)"></span> rgb(7.7377% 52.5730% 37.3213%)
216212
</div>
217213

218214
Instead of mixing all channels equally, color-adjusters can be used

css-color-5/images/CH-mixing3.svg

Lines changed: 39 additions & 39 deletions
Loading

0 commit comments

Comments
 (0)