Adding fill="currentColor" to the svg icon is invalid when setting the color

cause

Some SVG images already have the fill attribute set in the definition, which may cause manual changes to the fill color to have no effect. To solve this problem, the following method can be used to remove the fill attribute that comes with SVG. The personal center icon in the figure below is downloaded from the iconfont, it can be seen that it will not be affected when the color of the fill attribute is changed.

insert image description here

Solution

You can open the svg icon with the computer's built-in WordPad, or open the icon with a text editor, search for fill, delete the line break style, and save it.

insert image description here
The following is the result after successful modification, you can modify the color by yourself.
insert image description here

Guess you like

Origin blog.csdn.net/qq_36660135/article/details/131192200
Recommended