Skip to content
pixi-silk
GitHub repository
Class

SwatchPalette

import { SwatchPalette } from 'pixi-silk/ui/color';

Swatches to click: a fixed palette or the recent colours of a model, as a grid or a ring. Dragging across swatches previews them, releasing commits. The swatch matching the current colour wears a ring. A ring layout centres on the origin, a grid starts at it.

Extends#

  • Container

Constructors#

Constructor#

new SwatchPalette(options?: SwatchPaletteOptions): SwatchPalette;

Parameters#

ParameterType
optionsSwatchPaletteOptions

Returns#

SwatchPalette

Overrides#

Container.constructor

Properties#

PropertyModifierTypeDescriptionDefined in
hoveredreadonlySignal<number>Index of the swatch under the pointer, or -1.ui/color/SwatchPalette.ts:51
modelreadonlyColorModelThe colour this palette writes to.ui/color/SwatchPalette.ts:49

Accessors#

colors#

Get Signature#

get colors(): readonly number[];

Colours shown, in order, as 0xRRGGBB. The fixed colours, or the model’s history.

Returns

readonly number[]

Methods#

destroy()#

destroy(options?: DestroyOptions): void;

Stops the animation and unsubscribes from the model. Destroys children by default.

Parameters#

ParameterType
options?DestroyOptions

Returns#

void

Overrides#

Container.destroy

tick()#

tick(dt: number): boolean;

Advances the animation by dt seconds (only needed with ticker: null). Returns true while moving.

Parameters#

ParameterType
dtnumber

Returns#

boolean