Map colours

Recolour the whole base map with ten semantic colours in one call: every shade, outline and variant the style derived from one of them follows it

View on GitHub
SDK 1.0.0

Pick a colour set from the panel, or set one of the ten colours by hand, and the map redraws under it.

  • setMapColors takes any subset of the ten and re-derives every shade the style built from each one, by the style’s own offsets, so a set recolours the map rather than inverting it.
  • Each picker starts from getKnob, which reads the colour in force off the loaded style, so the pickers follow a style switch with no colour table of their own.
  • exportStyle returns the recoloured style as a MapLibre StyleSpecification, ready to store or diff.

Related examples