Avoid set styles directly in JS
joostf opened this issue · 6 comments
Not really sure that would work since it's unknown how many colors the API can give back. This line is used to generate small divs that show the colors the artwork exists of.
Pretty sure I can't generate all necessary css variables and enough css rules in my css file to make that happen dynamically, right?
I would think, one custom variable (--color) should be enough? Or am I not thinking straight?
Well you would need a custom variable for each color, otherwise the divs that are supposed to represent (for example) 6 different colors would end up having the same color right?
The only way I can think of making that work is to make as many css variables as there are colors returned from the api within a js loop. Gonna look in to that.