Skip to content

Commit 6c3245b

Browse files
committed
[css-color-5] Improve example, w3c#7771
1 parent 639a8ac commit 6c3245b

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

css-color-5/Overview.bs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -966,10 +966,10 @@ which are then carried forward as missing.
966966
<pre highlight=css>
967967
html { --bg: <span class="swatch" style="--color: rgb(51.5% 48.5% 48.5%)"></span> hsl(none 3% 50%); }
968968
.foo {
969-
--darker-bg: oklch(from var(--bg) calc(l * 0.8) c h);
969+
--darker-bg: <span class="swatch" style="--color: rgb(37.86% 35.24% 35.91%)"></span> oklch(from var(--bg) calc(l * 0.8) c h);
970970
}
971971
.bar {
972-
background: linear-gradient(in Oklab to right, var(--darker-bg), #4C3);
972+
background: linear-gradient(in Oklab to right, <span class="swatch" style="--color: rgb(37.86% 35.24% 35.91%)"></span> var(--darker-bg), <span class="swatch" style="--color: #4C3"></span> #4C3);
973973
}
974974
</pre>
975975

@@ -978,8 +978,19 @@ which are then carried forward as missing.
978978
but the analogous hue component is carried forward
979979
giving oklch(0.592 0.009 none).
980980
These values are then used in the relative function, giving
981-
oklch(0.474 0.009 none).
981+
the darker color oklch(0.474 0.009 none).
982982

983+
The light green in the gradient is
984+
<span class="swatch" style="--color: #4C3"></span> oklch(0.743 0.222 141.6),
985+
and so, when interpolated, the other color take that hue,
986+
becoming
987+
<span class="swatch" style="--color: rgb(34.96% 36.56% 34.72%)"></span> oklch(0.474 0.009 141.6).
988+
989+
Thus, the gradient will have a constant greenish hue.
990+
991+
If an implementation failed to do this carrying forward,
992+
the grayish --darker-bg would have a hue of 0,
993+
giving an undesirable reddish tint at the start of the gradient.
983994
</div>
984995

985996
<h3 id="relative-RGB">Relative sRGB Colors</h3>

0 commit comments

Comments
 (0)