The CSS alpha() function takes a relative color and adds transparency to it.

.some-element {
  background-color: alpha(from orange / 25%); /* 25% transparency */
}

Pretty straightforward, right? Well, there’s more to it. For one, did you see that we’re working with a named color in that last example? Nice, right? Normally we would have to use a hex value or some color function instead to get that same level of transparency because named colors can’t accept alpha values.

Another thing, notice that we’re also working with the relative color syntax in that example. That’s a nice way to make the concept of transforming colors consistent across the board.

When would you need this? It’s a fair question! Sure, it makes sense when working with named colors, but we’re not really supposed to use named colors, right? They don’t always look the same in every browser.

Color variations

A better use case is when you have a design token for a color that’s a solid value, no matter the type of color value.

:root {
  --orange: rgb(255, 122, 24);
}

Avoid new design tokens

And maybe you want to use that color to make chilled out link underlines. You could create a completely new design token just for that instance:

:root {
  --orange: rgb(255, 122, 24);
  --chill-orange: rgb(255, 122, 24 / 50%);
}

a {
  text-decoration-color: var(--chill-orange);
}

…or you could color-mix() it with transparent:

:root {
  --orange: rgb(255, 122, 24);
}

a {
  text-decoration-color: color-mix(in srgb, var(--orange), 50%);
}

…or just use the same token and transform it on that instance with some brevity:

:root {
  --orange: rgb(255, 122, 24);
}

a {
  text-decoration-color: alpha(from var(--chill-orange) / 50%);
}

Color theming

Come to think of it, that’s pretty handy for background-color too where you need a lighter variation of a color. I can also see it being used for color theming light and dark modes:

:root {
  /* Support color theming */
  color-scheme: light dark;

  /* Orange is chill in light mode and solid in dark mode */
  --orange: light-dark(alpha(from rgb(255, 122, 24) / 50%), rgb(255, 122, 24));
}

Overriding a color’s alpha

Let’s say you have a design token that already has a bit of alpha transparency on it:

:root {
  --orange: rgb(255, 122, 24 / 25%);
}

The alpha() function can override that when you might want additional transparency without changing the token at all:

:root {
  --orange: rgb(255, 122, 24 / 25%); /* 25% transparent */
}

a {
  text-decoration-color: alpha(from var(--orange) / 50%); /* 50% transparent */
}

Calculating alpha

We can also use alpha() with the calc() function. It’s a lot like the last example but we’re calculating the origin color’s alpha rather than setting it explicitly. That’s nice for situations where you want your chill variation to be relative to the origin color’s alpha rather than fixing it to a specific value:

:root {
  --orange: rgb(255, 122, 24 / 10%); /* 10% transparent */
}

a {
  /* 75% more transparent than --orange's 10% */
  text-decoration-color: alpha(from var(--orange) / calc(alpha * 75%));
}

Syntax

The official alpha() function syntax looks like this:

<alpha()> = alpha( from <color> / [ <alpha-value> | none ] )  

…where <alpha-value> can be a number or percentage. All the examples we looked at earlier use percentages, but a number between 0 and 1 as a decimal works as well:

text-decoration-color: alpha(from var(--orange) / calc(alpha * .75)); /* 75% transparent */

Specification

The alpha() function is defined in CSS Color Module Level 5 which is in Editor’s Draft at the time of writing. That means the information can change between now and when it formally becomes a Candidate Recommendation.

Browser support

The CSS alpha() function reached “Newly Available” status in September 2026 and is expected to be “Widely Available” in March 2029 at the time of writing.

Similar Posts