Skip to content

Instantly share code, notes, and snippets.

@anova
Last active November 30, 2021 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anova/bdb01d5f126f36a3cc4c4b3c2f54f533 to your computer and use it in GitHub Desktop.
Save anova/bdb01d5f126f36a3cc4c4b3c2f54f533 to your computer and use it in GitHub Desktop.
How do I apply opacity to a CSS color variable? (Stackoverflow answer)
:root {
--color-cultured-white: 242, 244, 247;
}
.element {
/*
How do I apply opacity to a CSS color variable?
https://stackoverflow.com/questions/40010597/how-do-i-apply-opacity-to-a-css-color-variable
https://stackoverflow.com/a/41265350 - BoltClock's answer
*/
background-color: rgba(var(--color-cultured-white), 0.25);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment