@@ -1703,6 +1703,46 @@ by reducing OkLCh Chroma, yields
17031703The OkLCh chroma has dropped from 0.251 to 0.117.
17041704</div>
17051705
1706+ <h3 id="relative-alpha">Relative Alpha Colors</h3>
1707+
1708+ The grammar of the ''alpha()'' function is as follows:
1709+
1710+ <pre class='prod'>
1711+ <dfn>alpha()</dfn> = alpha([from <<color>> ]
1712+ [ / [<<alpha-value>> | none] ]? )
1713+ </pre>
1714+
1715+
1716+ Within a [=relative color=] syntax ''alpha()'' function,
1717+ the allowed [=component keywords=] are:
1718+
1719+ * <dfn value for="alpha()">alpha</dfn> is a <<number>> that corresponds to the
1720+ [=origin color's=] alpha transparency. 1.0 is equivalent to 100%.
1721+
1722+ The color components of the [=origin color=] are unchanged,
1723+ the alpha component is modified or replaced.
1724+ The result of this function is in the color space of the origin color.
1725+
1726+ <div class="example" id="ex-alpha-replace">
1727+ For example, here the result is the same as the origin color,
1728+ but the alpha is changed to 80%
1729+
1730+ <pre highlight=css>
1731+ --mycolor: <span class="swatch" style="--color: rgb(71.122% 22.105% 89.033% / 0.3)"></span> oklch(60% 0.25 315 / 0.3);
1732+ <span class="swatch" style="--color: rgb(71.122% 22.105% 89.033% / 0.8)"></span> alpha(from var(--mycolor) / 80%);
1733+ </pre>
1734+ </div>
1735+
1736+ <div class="example" id="ex-alpha-change">
1737+ For example, here the result is the same as the origin color,
1738+ but the alpha is modified to be half of that in the origin color
1739+
1740+ <pre highlight=css>
1741+ --mycolor: <span class="swatch" style="--color: rgb(71.122% 22.105% 89.033% / 0.8)"></span> oklch(60% 0.25 315 / 0.8);
1742+ <span class="swatch" style="--color: rgb(71.122% 22.105% 89.033% / 0.4)"></span> alpha(from var(--mycolor) / calc(alpha * 0.5));
1743+ </pre>
1744+ </div>
1745+
17061746<!--
17071747 ██████ ███████ ██ ███████ ████████ ███ ███
17081748██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
0 commit comments