简体   繁体   中英

Can't change color of React icons (BiHomeAlt, BiSlider , FaTasks)

In React you can change the color of an icon with icon context or the style attribute:

<IconContext.Provider 
  value={{size: '40px' ,stroke: 'red',color:'red',fill:'red}} 
>
  <FaTasks>
</IconContext.Provider>

but it's not working what did i wrong i found some similar request on stackoverflow and some sort of bug request on github https://github.com/react-icons/react-icons/issues/404 or is it possibel that some react icons can't be styled with colors

and what's the difference between stroke ,fill ,color?

just add color prop or fill prop, i cant remember which one. lol

<FaTasks color="red" fill="red">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM