Is there a way to change the color of my SVG icon based on its background? I have this star icon with the following code:
<svg width="33" height="33" viewBox="0 0 33 33" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M16.5344 5.82104L19.7321 12.087L26.6796 13.1919L21.7084 18.1694L22.8045 25.1183L16.5344 21.9286L10.2644 25.1183L11.3604 18.1694L6.38928 13.1919L13.3367 12.087L16.5344 5.82104Z" stroke="black" stroke-width="2"/>
</svg>
When placed on a white background, it looks like this with black stroke, as shown in the image below:
https://i.sstatic.net/T4mlY.png
If I add the same star icon to a button component, I want it to have a white stroke instead of black. I tried using
svg { fill: currentColor) // then it's invisible on white background, because of its whiteness.
like below, How can I achieve a white star without a black stroke?
https://i.sstatic.net/U522V.png
Instead of black stroke on the star, I want it to be displayed as shown here: https://i.sstatic.net/ICrRt.png
After trying the suggestion of using two props: scgStroke and svgFill, now I get a black-filled star on a white background and a different display on a button as shown below: https://i.sstatic.net/edlED.png https://i.sstatic.net/xVsQc.png
I would like the outside stroke to be visible rather than a white fill (fill = "white"), something similar to the image below: https://i.sstatic.net/idBtv.png