A Palette is an array of BlockProperties entries describing the visual properties of its owner Shape's blocks.

The entries of a palette can be changed at runtime with a few specific caveats:
- only colors that are unused by the shape can be removed from its palette,
- changing a color from opaque to/from transparent will require a call to shape:RefreshModel() to be reflected on the existing shape blocks,
- changing the [BlockProperties.Light] or [BlockProperties.Color]'s alpha values will only be reflected on the baked lighting after calling shape:ComputeBakedLight (as of 0.0.47, only relevant for Map)


integer AddColor ( Color newColor )

Adds a new BlockProperties entry with the given color. Returns palette index at which it was added.

-- add red Color to the shape
myShape.Palette:AddColor(Color(255, 0, 0))

Returns the palette index of the latest entry corresponding to given color, nil if not found.

-- get myShape's red Color index
local idx = myShape.Palette:GetIndex(Color(255, 0, 0))
boolean RemoveColor ( Color colorToRemove )

Removes the BlockProperties entry at given index, if it is unused. Returns true if it was removed.

-- remove red Color from the shape if not used
local removed = myShape.Palette:RemoveColor(Color(255, 0, 0))


Maximum number of BlockProperties entries in a Palette. Imported shapes or shapes from previous versions may exceed this limit but no new entry can be added.