Use filters to transform to any color.
I recently found this solution, and hope somebody might be able to use it. Since the solution uses filters, it can be used with any type of image. Not just svg.
If you have a single-color image that you just want to change the color of, you can do this with the help of some filters. It works on multicolor images as well of course, but you can't target a specific color. Only the whole image.
The filters came from the script proposed in How to transform black into any given color using only CSS filters If you want to change white to any color, you can adjust the invert value in each filter.
.startAsBlack{_x000D_
display: inline-block;_x000D_
width: 50px;_x000D_
height: 50px;_x000D_
background: black;_x000D_
}_x000D_
_x000D_
.black-green{_x000D_
filter: invert(43%) sepia(96%) saturate(1237%) hue-rotate(88deg) brightness(128%) contrast(119%);_x000D_
}_x000D_
_x000D_
.black-red{_x000D_
filter: invert(37%) sepia(93%) saturate(7471%) hue-rotate(356deg) brightness(91%) contrast(135%);_x000D_
}_x000D_
_x000D_
.black-blue{_x000D_
filter: invert(12%) sepia(83%) saturate(5841%) hue-rotate(244deg) brightness(87%) contrast(153%);_x000D_
}_x000D_
_x000D_
.black-purple{_x000D_
filter: invert(18%) sepia(98%) saturate(2657%) hue-rotate(289deg) brightness(121%) contrast(140%);_x000D_
}
_x000D_
Black to any color: <br/>_x000D_
<div class="startAsBlack black-green"></div>_x000D_
<div class="startAsBlack black-red"></div>_x000D_
<div class="startAsBlack black-blue"></div>_x000D_
<div class="startAsBlack black-purple"></div>
_x000D_