How to create color shades using CSS variables similar to darken() of SASS?
I'm looking a way of modifying a CSS variable as you would in SCSS Define a color like primary - and automatically I would get shades for focus and actives states. Basically, would like to change one variable in css variables and get 3 shades of the same color. What Id like to achieve in CSS $color-primary: #f00; .button { background: $color-primary; &:hover, &:focus { background: darken($color-primary, 5%); } &:active { background: darken($color-primary, 10%); } } trying to achieve: :root { --color-primary: #f00; --color-primary-darker: #f20000 // var(--color-primary) * 5% darker --color