How to modify the fill color of an SVG image when being served as background image?

You can use CSS masks, With the ‘mask’ property, you create a mask that is applied to an element.

.icon {
    background-color: red;
    -webkit-mask-image: url(icon.svg);
    mask-image: url(icon.svg);
}

For more see this great article: https://codepen.io/noahblon/post/coloring-svgs-in-css-background-images

Leave a Comment