Skip to content

@graphty/graphty-element / catalog / paletteDescriptor

Function: paletteDescriptor() ​

paletteDescriptor(id): PaletteDescriptor | undefined

Defined in: graphty-element/src/catalog/palettes.ts:224

Find one palette by its name.

THE BUILT-IN TABLE IS SEARCHED FIRST AND THE REGISTRY SECOND, which is what makes a registered palette reachable by everything that already asks this question -- the ramp a layer paints through, the legend, and the check a saved document is read against -- without a plugin ever being able to change what a built-in name means. Nothing can take a built-in id anyway, because registration refuses one, so the order costs nothing and says the rule out loud.

A lookup that missed the registry would leave the extension point half-built in the worst shape there is: the palette visible in a picker, chosen by a reader, and then refused by the repaint that tried to paint with it.

Parameters ​

id ​

PaletteId

The palette name, such as "viridis".

Returns ​

PaletteDescriptor | undefined

The descriptor, or undefined when neither the element nor a plugin has that palette.