@john-mirage
Posted
Hello,
Changing the color of an icon can be achieved using an Svg.
I assume that you icon has a svg extension, it mean that you can grab the svg code that is in your svg file and use it in your HTML file.
<svg class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24px" height="24px" fill="currentColor">
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"/>
</svg>
note: to easily change the color of the icon with css make sure that the fill attribute has a value of currentColor. This way you can control the color of the icon with the color css property
.icon {
color: blue;
}
.icon:hover {
color: green;
}
Marked as helpful