Is there a way to change a mapbox-gl-js icon-image color?
This code taken from https://www.mapbox.com/mapbox-gl-js/example/geojson-markers/ won't change the marker color to red
map.addLayer({
"id": "markers",
"type": "symbol",
"source": "markers",
"layout": {
"icon-image": "{marker-symbol}-15",
"text-field": "{title}",
"text-font": ["Open Sans Semibold", "Arial Unicode MS Bold"],
"text-offset": [0, 0.6],
"text-anchor": "top"
},
"paint": {
"text-size": 12,
"icon-color" : "#ff0000"
}
});
I've tried all the options listed in the official documentation
I found a answer. You need sdf icons specifically for it to work.
https://github.com/mapbox/mapbox-gl-js/issues/1594
Unfortunately we don't have a turnkey solution for generating sdf icons but you can see an example of how its done in the maki project
https://github.com/mapbox/maki/blob/mb-pages/sdf-render.js
Updated by @yurik: The above link no longer works, probably refers to https://github.com/mapbox/maki/blob/b0060646e28507037e71edf049a17fab470a0080/sdf-render.js