cancel
Showing results for 
Search instead for 
Did you mean: 

Changing Colors of Vector Images

JAlbr.1
Associate III

Hello,

I understand there's been a similar question asked and answered here: https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/how-does-touchgfx-directly-change-the-color-of-the-picture-in/td-p/116908, but I'd really like to emphasize my desire to change the color of icons in my project at run-time. It seems like the only feasible way to do this is meticulously recreate my icons using the `Shape` tool, which is incredibly time consuming and tedious. Perhaps I can write some kind of helper class for that? Anybody ever do anything similar here? Trying to save on flash, plus I just don't like having a bunch of duplicate icons with different colors (example: SettingsIconBlack.svg, SettingsIconWhite.svg, SettingsIconGray.svg, etc.) It's clunky and gross.

Any advice is greatly appreciated, as always,

Jack

2 REPLIES 2

Hello @JAlbr.1,

As you mentioned, unfortunately, there is no direct way of changing the color of an image. But, a solution that comes to my mind (which will not work for SVGs, unfortunately) is to use Dynamic Bitmaps to load your images and you can manipulate them as well. Using dynamic bitmaps also helps you save on flash memory usage.

I hope this helps you!

Mohammad MORADI
ST Software Developer | TouchGFX
GaetanGodart
ST Employee

Hello @JAlbr.1 ,


Have you been able to move forward on your project?

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)