-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Symbol "icon-color" is not working #1817
Comments
The docs for
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 Closing as a duplicate of #1594 |
Are there any examples of how to change a style's sprite sheet, in that case? The documentation doesn't make it clear how to modify the sprites sheet of a style hosted on mapbox. |
I just spoke with the Studio team about this. We do not currently support sdf icons on Mapbox-hosted styles. Your best option is to generate separate icons for all the different colors you want. |
Just ran into this. High level of developer frustration here that there are no simple icons (or even a marker) that can trivially coloured. Can't easily adapt to circle even since I need text labels, necessitating multiple layers etc. |
+1 to @redspider 's comment Regarding the comment by @lucaswoj above ( #1817 (comment) ) does anyone have a working link to an example? That link is now dead. I just want a simple marker that isn't grey... |
Same here. Just migrated from Mapbox.js to Mapbox GL JS and I'm really surprised this isn't supported functionality. |
any example? |
I did a little bit of work on a tiny-sdf (a library to generate glyph SDFs from fonts) branch here: https://github.com/mapbox/tiny-sdf/compare/image-sdf It's experimental and is not yet ready for a release, but if you need to generate SDF icons in the meantime you can try checking out that branch and using the CLI tool added there (usage here). You can then add the generated SDF image to your spritesheet at runtime with |
Same here I am pretty surprised not to have a simple way to edit the color of my icon. Any update on this? |
@agrignard there are no plans to do this, but I suggest making your icon a font to make them recolorable and resizable |
Thank you for the answer, what do you mean by "I suggest making your icon a font". In my specific project, I have basically a lot of point (coming from a json) and I like to have a different color according to a specific attribute parsed (automatically) from my geojson. |
@agrignard It sounds like you may have more luck with expressions |
I had also a look at this exemple which work great to display circle. However I'd like also to add a text on top of the circle (that was of the reason that I choose the symbol first) When I write this I cannot see the text, is it allowed to use layout and paint at the same time. I guess I am doing something wrong here but I cannot figure out what. Should I use two different layer? One for the circle and one for the text?
|
I've done something similar with a circle layer and circle-color, and it worked well for me. I previously used the method of creating html elements that attached to the map and styling them, but that was too slow.
full source: https://tokyobikeshare.com/static/map.js |
@reustle you don't assign text to your circle in your example? Just a custom radius and a custom color? I am wondering how to add a text on top of a circle (a kind of label) without creating 2 different layer |
There is an ugly workaround to make SDF automagically work without actually converting the maki icons : just add |
It is still the case that none of the default icons support colours? |
I'm trying to change the color of a geoJSON marker by using "icon-color". It does have an image supplied, as the style reference indicates it requires, but the icon remains the default color. text-color is working correctly as expected.
JS fiddle example: https://jsfiddle.net/x6dr7sek/4/
The text was updated successfully, but these errors were encountered: