Recoloring SVG imported into JUCE


#1

I’ve been doing a BFS of the Drawable component created when an SVG (without color) is imported into Juce and using setFillType to set the brush used to draw the SVG. Is there a more elegant way to do this, or should I just build this as an internal utility function?

EDIT: Ideally, I would have the ability to alter the brush used when displaying the SVG/Drawable rather than it being a property of the structure. Is this at all feasible?

The SVGs I’m importing do not typically have any color defined, but in the future I might want to color only the uncolored elements.


#2

I’ve never heard the acronym “BFS” before, so not really sure what you’re trying to do. According to google, it might stand for “Bowling For Soup”, but that’s probably not what you meant.

Loading the SVG and then tinkering with the Drawables to change their settings is the only way I can think of to do this, so it sounds like you’re doing it right.


#3

Alright, I’ll keep doing it that way then.

BFS => Breadth-First Search


#4

Ah… breadth-first-search… I should have thought of that!


#5

Can the code for this be posted? I'd like to do similarly, as the raphaeljs svg's all come in black.


#6

Here is an example of doing it by replacing hex colours from SVG XmlElements. Using icons from this zip file. (icons source)