Why doesn’t currentColor work when importing SVGs using an img tag in VueJS? I’ve done it this way a million times before but for some reason it isn’t working when using an img tag and setting fill="currentColor", does anyone know what I need to change?
Does vue/nuxt require I import the svg in a different way? I don’t want to have it inline on the page ideally.
I’ve tried setting color with normal classes, tailwind classes, and even inline styles right in the element (not in the svg but in the img and in the container of the img and in the container of the container hahaha)
I’ve also tried setting fill even though I know that currentColor works with color.
SVG (This is one of my smaller ones, but the problem occurs with all svgs):
<svg width="800px" height="800px" viewBox="0 0 32 32" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="currentColor">
<g>
<path d="M22.3,8.4c-0.8,0-1.4,0.6-1.4,1.4c0,0.8,0.6,1.4,1.4,1.4c0.8,0,1.4-0.6,1.4-1.4C23.7,9,23.1,8.4,22.3,8.4z"/>
<path d="M16,10.2c-3.3,0-5.9,2.7-5.9,5.9s2.7,5.9,5.9,5.9s5.9-2.7,5.9-5.9S19.3,10.2,16,10.2z M16,19.9c-2.1,0-3.8-1.7-3.8-3.8 c0-2.1,1.7-3.8,3.8-3.8c2.1,0,3.8,1.7,3.8,3.8C19.8,18.2,18.1,19.9,16,19.9z"/>
<path d="M20.8,4h-9.5C7.2,4,4,7.2,4,11.2v9.5c0,4,3.2,7.2,7.2,7.2h9.5c4,0,7.2-3.2,7.2-7.2v-9.5C28,7.2,24.8,4,20.8,4z M25.7,20.8 c0,2.7-2.2,5-5,5h-9.5c-2.7,0-5-2.2-5-5v-9.5c0-2.7,2.2-5,5-5h9.5c2.7,0,5,2.2,5,5V20.8z"/>
</g>
</svg>
vue.js:
<div class="socials text-white">
<NuxtLink to="https://www.instagram.com/blahblah" class="text-white">
<img src="/images/icons/insta.svg" alt="Instagram" class="text-white"/>
</NuxtLink>
</div>
css
.socials {
color: var(--white);
fill: var(--white);
a {
color: var(--white);
fill: var(--white);
}
img {
color: var(--white);
fill: var(--white);
}
}
I have no fills or colors set anywhere in the SVGs, I have tried setting all the css styles and the tailwind styles to important and nothing does anything other than putting the color directly into a fill tag in the .svg file!!! why?!