For example i want replace fill attribute fill="#87B0EE"
in svg image code that way that i can have access to it and can change it states via css variables. Like this: fill="var(--color,#87B0EE)"
. That because shadow-root not allow have access to some tags in svg image code and it does not allow, for example, the path tag to inherit the property of its parent.
I use the gulp-svg-sprite plugin to create an svg sprite. It has settings where I can remove some attributes if necessary and many many others settings. But I can't find a way how I can replace it with some custom value.
Im using inline svg and insert it via use tag:
<svg class="contact__email-image" viewBox="0 0 16 12" width="16" height="12">
<use xlink:href="img/icons/icons.svg#mail-black-envelope-symbol"></use>
</svg>
I think my task is to create a function that can replace an attribute in the svg code and insert it into the gulp svg sprite plugin in such a way that it can work. I know how to change the color of an svg image, but I will have to add my own attribute parameter to each svg image each time. I would like to automate this process without doing it manually every time.