Let’s say I have a CSS like that, which uses CSS Relative Colors syntax:
.my-element {
color: rgb(from #aabbcc r + 30 g b - 30 / 80%);
}
(in real life, this example would use CSS variables which I know how to substitute with actual values, so I simplified it).
In CSS it calculates a color with increased red and decreased blue channels, and with 80% alpha-channel.
I need to get that color and further manipulate it in my JS. Tried using getComputedStyle
– it doesn’t help, just returns the initial string representation of the color.
So, is there a way to get that final color in JS? Any built-in solution or a library?