Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Legend

A discrete colour legend — a swatch and label per entry, with an optional title.

Import

from manywidgets import Legend

Example

from manywidgets import Legend

Legend(
    [
        [[230, 30, 30], "High"],
        [[30, 160, 30], "Medium"],
        [[30, 90, 230], "Low"],
    ],
    title="Category",
)

API

TraitTypeDefaultDescription
entriesListRows as [color, label]; color is [r,g,b]/[r,g,b,a] (0–255) or a CSS string.
titleUnicode''Optional legend title.
widget_idUnicode''Stable unique id used for cross-widget linking (auto-assigned).

Each entry is [color, label]. color is an [r, g, b] / [r, g, b, a] list (0–255, deck.gl convention) or a CSS colour string (e.g. "#e11"). Pair it with a styled lonboard layer — see the interop example.