Closed Tonidor closed 5 years ago
Unfortunately you cannot access the raw SVG like that, because it's already been rasterized into a WebGL texture by that point. The rasterization is quite low-level in the browser, it's the result of creating an <img>
/Image
with the SVG as src
.
Interesting idea though! :)
Sorry I actually misinterpreted what you were trying to do.
You can apply color
to SVG icons, but by default it's going to just multiply the color
you provide the pixel value of the SVG. So white pixels will end up being the color you set (white is all 1 * color
). Black pixels would stay black (0 * color
). Other colors will multiply component-wise. So you might be able to arrange that to work. Or, you could also write a custom style (under styles
) and use a filter
shader block to do something more custom: https://tangrams.readthedocs.io/en/latest/Overviews/Shaders-Overview/#filter
I'm currently trying to manipulate the color of some POI icons (SVG) and I need them to change whatever is not white. Is it possible to target a specific fill component via the tangrams draw/color property?
This is a part of my scene.yaml of the layer I wish to change:
This is the funtion getColor that is referenced above:
Icon style:
This is how it look's so far: