Skip to content

@graphty/graphty-element / index / registerPalette

Function: registerPalette() ​

registerPalette(descriptor, options?): void

Defined in: graphty-element/src/catalog/paletteRegistry.ts:89

Register a palette so that a style layer, a legend and a saved document can all name it.

Parameters ​

descriptor ​

PaletteRegistration

The palette: an id, a plain name, a kind and its colour anchors, and optionally its capacity (derived when left off) and whatever colour-blindness safety it claims.

options? ​

RegisterOptions

Whether a collision with an existing registration throws instead of replacing.

Returns ​

void

Throws ​

A GraphtyError with E_BAD_COMMAND when the descriptor is malformed, naming the field, or with E_DUPLICATE_PLUGIN when the id is one the element ships.