# Recoloring SVG imported into JUCE

**URL:** <https://forum.juce.com/t/recoloring-svg-imported-into-juce/8393>\
**Category:** General JUCE discussion\
**Created:** [March 31, 2012, 1:53am UTC](https://forum.juce.com/t/recoloring-svg-imported-into-juce/8393 "2012-03-31T01:53:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steven](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@Steven](https://forum.juce.com/u/Steven)\
**Post date:** [March 31, 2012, 1:53am UTC](https://forum.juce.com/t/recoloring-svg-imported-into-juce/8393/1 "2012-03-31T01:53:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [March 31, 2012, 8:23am UTC](https://forum.juce.com/t/recoloring-svg-imported-into-juce/8393/2 "2012-03-31T08:23:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Steven](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@Steven](https://forum.juce.com/u/Steven)\
**Post date:** [April 1, 2012, 11:16am UTC](https://forum.juce.com/t/recoloring-svg-imported-into-juce/8393/3 "2012-04-01T11:16:37Z")

</div>

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

BFS =\> [Breadth-First Search](http://en.wikipedia.org/wiki/Breadth-first_search)

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [April 1, 2012, 12:45pm UTC](https://forum.juce.com/t/recoloring-svg-imported-into-juce/8393/4 "2012-04-01T12:45:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![joelt](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@joelt](https://forum.juce.com/u/joelt)\
**Post date:** [November 5, 2013, 1:28am UTC](https://forum.juce.com/t/recoloring-svg-imported-into-juce/8393/5 "2013-11-05T01:28:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Theadd](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/theadd/32/269_2.png) [@Theadd](https://forum.juce.com/u/Theadd)\
**Post date:** [November 11, 2013, 11:00pm UTC](https://forum.juce.com/t/recoloring-svg-imported-into-juce/8393/6 "2013-11-11T23:00:36Z")

</div>

[Here](https://gist.github.com/Theadd/7422004#file-swap-svg-colours-using-juce) is an example of doing it by replacing hex colours from SVG XmlElements. Using icons from [this](https://github.com/Theadd/JUCE-Designer/blob/master/BinaryData/plain-svg-icons.zip?raw=true) zip file. ([icons source](http://snipicons.com/index.html))
