Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot change icon color when importing icons from react-icons repository #238

Open
Alihumza121 opened this issue Jul 17, 2021 · 3 comments

Comments

@Alihumza121
Copy link

Alihumza121 commented Jul 17, 2021

i am using as it is
import * as GrIcons from "react-icons/gr";

<GrIcons.GrAnnounce color="#004aff" size={18} />

@Alihumza121 Alihumza121 changed the title icon color is not changing in reacths icon color is not changing in reactjs Jul 17, 2021
@xiata
Copy link

xiata commented Oct 25, 2021

Noticed this as well. Some but not all icons have stroke="#000" in the svg markup which prevents the fill="currentColor" on the <svg> tag from working.

@halocline
Copy link
Collaborator

I am not super familiar with the react-icons project -- we will need to look into how Grommet Icons are plugging into their setup.

Accessing Grommet Icons directly allows for changing each icon's color as desired:

import * as GrIcons from "grommet-icons";

export default function App() {
  return <GrIcons.Announce color="#004aff" />;
}

CodeSandbox Example

@halocline halocline changed the title icon color is not changing in reactjs Cannot change icon color when importing icons from react-icons repository Oct 25, 2021
@calebchiam
Copy link

I was able to style it by adding a CSS class to the icon, i.e.

import { GrPrevious } from "react-icons/all";

export default function App() {
    <GrPrevious className={"someColor"} />
}

And in the css:

.someColor polyline {
    stroke: rgb(211, 211, 211) !important;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants