TLDR
In our Perspective projects we use a custom icon repository to display various components. We have use cases where different items/layers in the SVG need to be different colors -- often through dynamic bindings. By default, the color and styling properties of a Perspective Icon seem to change the color of all layers in the SVG. Is there any way that individual layers of an SVG can be accessed/edited through the Perspective Property Editor for an icon component?
Example
Suppose we have the following custom icon repository file, example.svg
. This file is a subset of the example from the Ignition User Manual:
<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!--roman numeral one icon-->
<svg viewBox="0 0 24 24">
<g id="one">
<rect
id="rect3723" width="15.09025" height="3.0526078" x="4.4548745" y="2.4385488" />
<rect
id="rect3723-3" width="15.09025" height="3.0526078" x="4.4548745" y="19.510113"/>
<rect
id="rect3755" width="3.4557824" height="16.990929" x="10.272108" y="3.5045362" />
</g>
</svg>
<!--roman numeral two icon-->
<svg viewBox="0 0 24 24">
<g id="two">
<rect
id="rect3723" width="15.09025" height="3.0526078" x="4.4548745" y="2.4385488" />
<rect
id="rect3723-3" width="15.09025" height="3.0526078" x="4.4548745" y="19.510113" />
<rect
id="rect3755" width="3.4557824" height="16.990929" x="6.8435426" y="3.5045362" />
<rect
id="rect3755-9" width="3.4557824" height="16.990929" x="13.700686" y="3.5045002"/>
</g>
</svg>
</svg>
Suppose we have an icon component for the roman numeral one (path = example/one) from above. Is there a way to only alter the color of the rectangle with id="rect3723" within the Icon's perspective property editor?
Current Approaches
Embedded views
We have been mitigating the above issue by creating views that have multiple icons (subsets of a full SVG) and creating parameters to control the color of each item. Thus, we use embedded views instead of icons throughout the project.
Embedded SVGs / Drawing Components
When I embed an SVG by dragging it in to a Perspective View, it has an elements property where I'm able to access the various SVG layers and edit them accordingly.
This is exactly what we need -- my only concern is that it can degrade performance. If we can achieve this but using icons stored in the Gateway, that would be ideal. I'd love to know if this is already a capability or what the best approach would be.