Unable to change SVG icons color in react

I have downloaded svg files and added fill = "currentColor" to each individual . THen i created a file to export these svg, so i can use it in other components. THis is where the issue happens, i cant change the color via CSS , i even added !important, still its showing default black color. ANyone knows how to fix it?
imageExport.jsx

export { default as email } from "./envelope-solid.svg";
export { default as lock } from "./lock-solid.svg";
export { default as eyeOpen } from "./eye-solid.svg";
export { default as eyeClose } from "./eye-slash-solid.svg";
imageExport.jsx

export { default as email } from "./envelope-solid.svg";
export { default as lock } from "./lock-solid.svg";
export { default as eyeOpen } from "./eye-solid.svg";
export { default as eyeClose } from "./eye-slash-solid.svg";
component.jsx


import {
email as EmailIcon,
eyeClose as PasswordHide,
eyeOpen as PasswordShow,
lock as LockIcon,
} from "../assets/imageExport";


<img
src={EmailIcon}
alt=""
width={20}
height={20}
className="icons_mail"
/>
component.jsx


import {
email as EmailIcon,
eyeClose as PasswordHide,
eyeOpen as PasswordShow,
lock as LockIcon,
} from "../assets/imageExport";


<img
src={EmailIcon}
alt=""
width={20}
height={20}
className="icons_mail"
/>
.icons_mail {
color: rebeccapurple !important;
}
.icons_mail {
color: rebeccapurple !important;
}
3 Replies
Mannix
Mannix7mo ago
the svg need to be an inline svg element not a img tag with svg file set as src. also it's fill not color
Avinash
Avinash7mo ago
i used fill it wasnt working. if i paste svg , my code becomes even more messier. its working jollykevin
Want results from more Discord servers?
Add your server
More Posts
SECURING CSS CODEHow to secure and protect the css code from "source code"? Like when you click the stylesheets fileHow do I import swiper.js package from node_modules into my main js.file?Hey guys, So I downloaded the swiper.js packackge via npm and did exactly what the doc says but it Is there a website or a repository in which we can see when CSS features were added?Sometimes I'll be looking up a feature on CanIUse or developer.mozilla.org to check its compatibilitDate Input field for birthday, 'masking' the user input, incorporating 'show' buttonI'm trying to create a birthday date input field inside of a React-bootstrap 'Form'. What I want iHow to horizontally center an element with translated content outside of it's widthI have a heading h3: ```html <h3>This is the width <span>extend</span></h3> ``` ```css h3 { widthIssue with Vite projectHello everyone, I'm having an issue with the Vite project. The issue is when I run the command npm rHow can I make the top of this overlay transparent?Hey guys I got this code and you can see it looks like like a "box"but I'm trying to make the top moText in Responsive Background Image Overflow```css .background-image-anime { width: 100%; background-size: 100% auto; background-image: urWhat tag should be used in the shown section?What tag should I use in the part where there is a photo, which is the best approach?What should I do to this svg background (I'm new here and still learning)it seems like this svg image that I'm going to put it to the background of my heading section seems