Colouring an SVG

So, loading an SVG is easy and typically, setting the colour of an display object is easy. I have an SVG which is basically a black silhouette. I want to change the colour dynamically, but setFillColor() does not work and, of course, .fill only sets the colour of the rectangular shape the SVG produces.

Does anyone have a method for colouring, in code, a black SVG?

“basically a black silhouette… but setFillColor() does not work”

I assume the method itself can be called?

Black will basically be (0, 0, 0), and setFillColor() simply multiplies the image color by the provided fill color. Try it with a white silhouette.

Yeah… I know why it doesn’t work :frowning: Would be great if a white silhouette was an option.

Would be great to be able to create masks etc in memory.

The Memory Bitmap plugin can be used to create on-the-fly masks.

https://docs.coronalabs.com/plugin/memoryBitmap/index.html

Rob

Tried it, interpolated it, looking good!

Not being able to change stroke color to it is bad and going through the loops by using nanosvg.newTexture is not worth the hassle.

Please take it to the next level where it can be loaded and handled in the same way like other display objects, and it will be worth using.

For may applications, especially with dynamic scaling, vector graphics can be very useful.

“basically a black silhouette… but setFillColor() does not work”

I assume the method itself can be called?

Black will basically be (0, 0, 0), and setFillColor() simply multiplies the image color by the provided fill color. Try it with a white silhouette.

Yeah… I know why it doesn’t work :frowning: Would be great if a white silhouette was an option.

Would be great to be able to create masks etc in memory.

The Memory Bitmap plugin can be used to create on-the-fly masks.

https://docs.coronalabs.com/plugin/memoryBitmap/index.html

Rob

Tried it, interpolated it, looking good!

Not being able to change stroke color to it is bad and going through the loops by using nanosvg.newTexture is not worth the hassle.

Please take it to the next level where it can be loaded and handled in the same way like other display objects, and it will be worth using.

For may applications, especially with dynamic scaling, vector graphics can be very useful.