[SOLVED] Drawable::replaceColour() - how does it work?

I’m trying to load an SVG into a Drawable and then replace the color. However it doesn’t seem to detect the color for some reason. I made sure the SVG uses a pure red exclusively, as a fill, with no gradient.

My code is:

m_logo = Drawable::createFromSVGFile(File("/path/to/logo.svg"));
DBG("Colour found: " << (int)m_logo->replaceColour(Colour(0xFF, 0x00, 0x00), m_color_content));

This will always output Color found: 0. I’ve attached the logo in case it helps!
logo.zip (4.9 KB)

I took a deep dive into the underlying JUCE code:

Turns out that the color I used was in fact not pure red, but had an alpha value. After rechecking with Inkscape, I could confirm that this was the case. However when editing the alpha value in Inkscape, it gets reset to to some random other value after saving.

So it boils down to my buggy Inkscape version (I’m still on one of the 0.9 pre-release versions). Time to upgrade!

Isn’t that every inkscape version? :wink:

5 Likes