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

**URL:** <https://forum.inductiveautomation.com/t/tip-how-to-create-svgs-and-changing-the-fill-color-dynamically/53361>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [November 22, 2021, 9:40pm UTC](https://forum.inductiveautomation.com/t/tip-how-to-create-svgs-and-changing-the-fill-color-dynamically/53361 "2021-11-22T21:40:14Z")\
**Posts on this page:** 1\
**Showing post:** 25

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [March 1, 2022, 7:22pm UTC](https://forum.inductiveautomation.com/t/tip-how-to-create-svgs-and-changing-the-fill-color-dynamically/53361/25 "2022-03-01T19:22:35Z")

</div>

I think that you may be running in to this:

> [@Embedding plain SVG results in incorrect rendering](https://forum.inductiveautomation.com/t/embedding-plain-svg-results-in-incorrect-rendering/55778/2):
>
> The short version: The SVG spec is immense. Really, truly, ridiculously immense. We employ some extremely limited parsing when you drop an SVG in and choose to embed it. If there’s anything in the SVG we don’t recognize, we don’t reject it - we just don’t assign it any meaning in the output. For some things, that might be plausible to change on our side. For more exotic SVG features, it’ll probably never happen when embedding in this way; instead, just leave your SVG intact and display it as …

Also, watch out for this:

> [@Creating animation-ready valve/pump SVGs](https://forum.inductiveautomation.com/t/creating-animation-ready-valve-pump-svgs/46172/4):
>
> Performance is the reason. Creating the nested components is expensive; for very large SVGs significantly so.

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

```auto
<?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.

> [@\[BUG-11342\] Perspective - Can't draw any shapes](https://forum.inductiveautomation.com/t/bug-11342-perspective-cant-draw-any-shapes/20690/22):
>
> Not sure if worth mentioning, that if you do use Inkscape, you should save your SVGs as an Optimised SVG and not as an Inkscape SVG. It pulls all the crap out of the file. I use these settings fwiw: Edit: uncheck the top option, don't remove unused ids [image] [image] [image] Edit: maybe should uncheck the convert css to XML option

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.

---

_[View the full topic](https://forum.inductiveautomation.com/t/tip-how-to-create-svgs-and-changing-the-fill-color-dynamically/53361)._
