Customizing from a Flavor #206
Replies: 2 comments 3 replies
-
Thanks for the example. There is a small snippet in the docs here: https://docs.protomaps.com/basemaps/flavors#overriding-defaults So that way of using the spread operator to safely override I don't like the solution above however because drawing a label with |
Beta Was this translation helpful? Give feedback.
-
FWIW, in our use case, we are not importing modules but instead including the
In other words, it would be useful to have a way to access a named flavors when using |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
First off, thank you for Protomaps @bdon, it's awesome and the company I work for has become a sponsor.
Second, where I work we are super locked into leaflet having built a huge pile of features on top of it which is great, but it makes adopting a lot of the cool stuff happening in web mapping elsewhere tough sometimes. I did want to share a pattern, and maybe it can be used in a future guide here, about how to style named flavors beyond language.
Also, I am not great with Javascript, so maybe this would be super obvious to others and not needed in a guide. My use case was initially, I love the flavors, but we wanted the option to hide labels to make the maps more minimal. And then of course a million other lower priority use cases for highlighting various features. How I figured out how to do this was like so:
So by importing the
namedFlavor
function from@protomaps/basemaps
you can just use the spread to modify any attribute in the flavor interface in your paintRules and labelRules.Beta Was this translation helpful? Give feedback.
All reactions