Changing Colors of Vector Images
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-10-18 9:21 AM
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
- Labels:
-
TouchGFX
-
TouchGFX Designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-10-21 3:11 AM
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!
ST Software Developer | TouchGFX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-11 5:07 AM
Hello @JAlbr.1 ,
Have you been able to move forward on your project?
Regards,
Software engineer at ST (TouchGFX)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-03-25 8:42 PM
Haha, kind of. It's funny, I'm still looking for a way to get around this and decided to google it again and came across my own forum post. Right now, we just have several of the same vector in different colors. Literally the only change of the XML code is the fill. I'd really like to hack the static constexpr fill variables in SVGDatabase. Obviously that's generated code and would somehow have to go over the head of that class. I will put some hours into it to see if I can do it. If there's a way to do this easily, let me know.
