Tripling a color into separate H, S, and L custom properties is usually more trouble than it's worth. A middle ground works better: store one variable for the color and one for its channel values.
html {
--color-1-hsl: 200deg 15% 73%;
--color-1: hsl(var(--color-1-hsl));
}
With two custom properties per color in a design system, you get both an easy way to reference the color and a way to apply alpha to it later.
.card {
background: var(--color-1);
}
.card-with-alpha {
background: hsl(var(--color-1-hsl) / 0.5);
}
Beyond that, there isn't really another way to take an existing CSS color and add transparency to it, with one notable exception in the specs.
/* Future CSS! (works in Safari TP right now) */
.card-with-alpha {
background: hsl(from var(--color-1) h s l / 0.5);
}
Relative HSL syntax is promising, but it isn't something to count on in production yet.
Paint worklets and the Houdini route
Houdini paint worklets are in a similar spot: no Firefox or Safari support yet. That's unfortunate, because Dave Rupert demonstrated the underlying technique. A paint worklet returns an image drawn with <canvas> APIs, so you can paint a rectangle in Canvas using any color format, set globalAlpha, and return the result as an image. That effectively unlocks alpha on any color format, and it works in Chrome.
The code is available on GitHub, along with a write-up and a video.
The pragmatic choice
For a system that has to run in production, the custom properties approach above is the safer bet. The factor-that-out-as-HSL-parts problem, discussed in "Different Degrees of Custom Property Usage," is one step too far; the two-variable pattern is the practical compromise that leaves the door open for alpha.



