Yeah, attribute nth-child would be a nice one, hey.
Your right could actually have swapped for x on the use. You know how you get into this code and debugging, and then it sticks, haha.
As for your one star, that's not completely true. Since you want dynamic colors based on the same, it's almost impossible to overwrite the color then or do the half stars.
I'll put this on my list to refactor to use the x instead of the nth-child.
Also, you could have defs and created fixed defs for each option so you can just use 1 single-use, but that's if you need all of them.
Half-stars can easily be done using a linear gradient with two stops at 50% (you can even move it around at random). As for the dynamic colours, I don't really get what you mean by that. Unless you want to change the actual shape of the star, almost everything can be done using CSS.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
It'd be so nice if we could just do
and just use an attribute to do these things.
Setting that aside, here's a few things I don't completely like about this code:
nth-child
andtransform
, you could just addx
andy
attributes to theuse
element.<defs>
block at the beginning of the document for readability.This is what I came up with after some tinkering:
Yeah, attribute nth-child would be a nice one, hey.
Your right could actually have swapped for x on the use. You know how you get into this code and debugging, and then it sticks, haha.
As for your one star, that's not completely true. Since you want dynamic colors based on the same, it's almost impossible to overwrite the color then or do the half stars.
I'll put this on my list to refactor to use the x instead of the nth-child.
Also, you could have defs and created fixed defs for each option so you can just use 1 single-use, but that's if you need all of them.
Half-stars can easily be done using a linear gradient with two stops at 50% (you can even move it around at random). As for the dynamic colours, I don't really get what you mean by that. Unless you want to change the actual shape of the star, almost everything can be done using CSS.