You can use "currentColor" as the color value in SVG elements, to pick up the color attribute from CSS. For example:

<div style="color: red;">
  <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
    <rect width="50" height="50" fill="currentColor" />
  </svg>
</div>
Read more
Subscribe to svg