grommet-icons icon indicating copy to clipboard operation
grommet-icons copied to clipboard

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

Open Alihumza121 opened this issue 3 years ago • 3 comments

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

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

Alihumza121 avatar Jul 17 '21 06:07 Alihumza121

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.

xiata avatar Oct 25 '21 20:10 xiata

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 avatar Oct 25 '21 22:10 halocline

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;
}

calebchiam avatar Jan 14 '22 02:01 calebchiam