Loading...
:root {
--brand: #1f5eff;
--brand-50: #1f5eff80;
}:root {
--brand: #1f5eff;
--brand-50: rgb(from var(--brand) r g b / 50%);
}The variant is derived from --brand, so changing the brand color updates its transparent version too.
calc(), which makes the color invalid.l inside rgb(from ...).from syntax instead of extra hardcoded hex values.oklch(from ...), so the hue stays stable.calc(), like calc(alpha / 2).Yes. The origin after from can be any color, including hex, names or var(), and the outer function sets the output space.
Lower the lightness channel, like hsl(from var(--brand) h s calc(l - 10)), or do the same in oklch() for a steadier hue.