Using pure CSS how can I lighten an RGB like: rgb(255, 0, 0)
SASS's lighten
mixin works well: lighten(rgb(255, 0, 0), 25%)
however it doesn't support CSS variables like this: lighten(var(--redColor), 25%)
I need to use CSS variables because you can change CSS variables on the fly after the page has loaded.
Things I've tried
opacity: 0.75
- Opacity makes the background bleed into the color which I don't want.filter: brightness(
- Filters affect the whole element but I just want to lighten specific colors.hsl(0, 100%, 50%)
- HSL looks promising though I need a way to convert RGB to HSL in order to lighten the RGB.
Ideally I hope to have a SASS mixin that does some CSS to lighten whatever color's passed into it.
filter
andbackground-image
won't work. – Billybillycock