# Class: PaletteRegistry
A PaletteRegistry is a container for Palette instances.
Palettes can be registered and retrieved by ID.
A set of standard palettes is registered automatically on creation of the PaletteRegistry. These match
the 5-color variants of the Color Brewer (opens new window) palettes.
The palette IDs match the Color Brewer IDs. For example, BuGn is the ID for the 5-color blue-green sequential
Color Brewer palette.
# Hierarchy
- PaletteRegistry
# Constructors
# constructor
+ new PaletteRegistry(): PaletteRegistry
Constructs a new instance of PaletteRegistry.
The standard Color Brewer palettes are automatically registered.
Returns: PaletteRegistry
# Methods
# get
▸ get(paletteId: string): Palette
Get the specified palette.
# Parameters:
| Name | Type | Description |
|---|---|---|
paletteId | string | Palette ID. |
Returns: Palette
# has
▸ has(paletteId: string): boolean
Returns true if the specified palette has been registered.
# Parameters:
| Name | Type | Description |
|---|---|---|
paletteId | string | Palette ID. |
Returns: boolean
# register
▸ register(paletteId: string, colors: [string, string, string, string, string]): void
# Parameters:
| Name | Type | Description |
|---|---|---|
paletteId | string | Palette ID |
colors | [string, string, string, string, string] | Array of CSS-format colors (color name, hex or color function). |
Returns: void
← Palette StateStore →