Skip to main content
7-Bedrock
April 9, 2024
Solved

svgViewer Widget . Can i change image color on svg

  • April 9, 2024
  • 1 reply
  • 954 views

I would like to know how to display an SVG image with the functionality I desire. If I read a boolean value as 'on', I want to show only green color and hide other colors. If it's 'off', then display only red color and hide other colors. Is there a way to achieve this?

Best answer by GabrielB

Hi,

 

Yes, there is a way but it's not made extremely easy. The SVG is ultimately like an HTML to which you can apply styles.

 

There was a widget made way back for this exact reason, to make floor plans and have colored statuses all over.

https://github.com/ptc-iot-sharing/SvgViewerWidgetTWX

It should come with the necessary documentation in the README.

 

Hope this helps,

Gabriel

1 reply

GabrielB12-AmethystAnswer
12-Amethyst
April 9, 2024

Hi,

 

Yes, there is a way but it's not made extremely easy. The SVG is ultimately like an HTML to which you can apply styles.

 

There was a widget made way back for this exact reason, to make floor plans and have colored statuses all over.

https://github.com/ptc-iot-sharing/SvgViewerWidgetTWX

It should come with the necessary documentation in the README.

 

Hope this helps,

Gabriel