Is there a way to dynamically set the value of a property for a CSS class without relying on a compiler or javascript?
:root {
--color-0 : red;
--color-1 : blue;
--color-3 : yellow;
}
.bg-color-[*] {
background-color: var(--color-[*]);
}
I am looking for a method where I can pass in a numeric value in my HTML to select the correct variable.
<div class="bg-color-1">This background should be red</div>
<div class="bg-color-2">This background should be blue</div>
<div class="bg-color-3">This background should be yellow</div>