new Palette(colors)
Create a palette from an array of Color objects
Parameters:
| Name | Type | Description |
|---|---|---|
colors |
Array.<Color> | array of Color objects |
- Source:
Members
colors
Get all colors in the palette
- Source:
length
Get the number of colors in the palette
- Source:
Methods
copy() → {Palette}
Return a copy of the palette
- Source:
Returns:
copy of the palette
- Type
- Palette
getColor(i) → {Color}
Get the color at index i. The index wraps around if it exceeds the number of colors
Parameters:
| Name | Type | Description |
|---|---|---|
i |
number | index of the color |
- Source:
Returns:
color at index i
- Type
- Color
reverse() → {Palette}
Reverts the order of colors in the palette
- Source:
Returns:
inverted palette
- Type
- Palette
rotate(n) → {Palette}
Rotate the colors in the palette by n positions
Parameters:
| Name | Type | Description |
|---|---|---|
n |
number | number of positions to rotate |
- Source:
Returns:
rotated palette
- Type
- Palette
(static) fromHEXArray(colors) → {Palette}
Create a palette from an array of HEX color strings
Parameters:
| Name | Type | Description |
|---|---|---|
colors |
Array.<string> | array of HEX color strings |
- Source:
Returns:
palette object
- Type
- Palette
(static) fromRGBArray(colors) → {Palette}
Create a palette from an array of RGB color arrays
Parameters:
| Name | Type | Description |
|---|---|---|
colors |
Array.<Array.<number>> | array of RGB color arrays |
- Source:
Returns:
palette object
- Type
- Palette