Color-legend control
When do you use it?
Add a color legend to your map.
Advanced Editor
Build a color-legend manually:
@controls {
bottom-left {
color-legend {
color {
value: red;
label: "All the red things";
}
color {
value: blue;
label: "All the blue things";
}
}
}
}Automatically build the color-legend from the element-color value in @settings:
@controls {
bottom-left {
color-legend {
colors: auto;
}
}
}
@settings {
element-color: categorize("Element type", set2);
}Supported properties
colorsdefaults toautoand tries to build the list of colors and labels
Check out our controls reference to see the full list of properties and values recognized by the color legend control.
The color-legend can be customized using nested color blocks which support the following properties:
valuethe color itself ("red" or "#BA462F")labelthe text to put next to the color
Last updated
Was this helpful?