Tip: how to create SVGs and changing the fill color dynamically

I think that you may be running in to this:

Also, watch out for this:

For simple things, I usually just draw them inside the designer, by embedding this blank SVG and adding the elements/paths that I need.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
  xmlns:svg="http://www.w3.org/2000/svg"
  xmlns="http://www.w3.org/2000/svg"
  width="50mm"
  height="50mm"
  viewBox="0 0 50 50"
  version="1.1">
</svg>

Those are the only tags outside of the actual elements that you need in an SVG.

For larger complicated SVG's I use Inkscape and save them as optimized. I stole the settings for that from @nminchin.

Honestly though, complex SVG's should be linked, and you should use separate SVG's only for the things which you must animate or interact with.

2 Likes