new PaletteFactory(palettes)
Create a palette factory from an array of palettes
Parameters:
| Name | Type | Description |
|---|---|---|
palettes |
Array.<Array.<Color>> | array of palettes, each palette is an array of Color objects or HEX color strings |
- Source:
Members
length
Get the number of palettes in the factory
- Source:
palettes
Get all palettes in the factory
- Source:
Methods
getPalette(n) → {Palette}
Get the palette at index n
Parameters:
| Name | Type | Description |
|---|---|---|
n |
number | index of the palette |
- Source:
Returns:
palette at index n
- Type
- Palette
getRandomPalette(rand, randomize) → {Palette}
Get a random palette from the factory
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
rand |
RandomClass | random number generator with a random() method. Defaults to Math | |
randomize |
boolean | true | whether to randomize the order of colors in the palette. Defaults to true |
- Source:
Returns:
random palette
- Type
- Palette
(static) fromCMYKArray(cmyk_palettes) → {PaletteFactory}
Create a palette factory from an array of CMYK palettes
Parameters:
| Name | Type | Description |
|---|---|---|
cmyk_palettes |
Array.<Array.<Array.<number>>> | array of palettes, each palette is an array of CMYK color arrays |
- Source:
Returns:
palette factory object
- Type
- PaletteFactory
(static) fromHEXArray(hex_palettes) → {PaletteFactory}
Create a palette factory from an array of HEX palettes
Parameters:
| Name | Type | Description |
|---|---|---|
hex_palettes |
Array.<Array.<string>> | array of palettes, each palette is an array of HEX color strings |
- Source:
Returns:
palette factory object
- Type
- PaletteFactory
(static) fromHSLArray(hsl_palettes) → {PaletteFactory}
Create a palette factory from an array of HSL palettes
Parameters:
| Name | Type | Description |
|---|---|---|
hsl_palettes |
Array.<Array.<Array.<number>>> | array of palettes, each palette is an array of HSL color arrays |
- Source:
Returns:
palette factory object
- Type
- PaletteFactory
(static) fromRGBArray(rgb_palettes) → {PaletteFactory}
Create a palette factory from an array of RGB palettes
Parameters:
| Name | Type | Description |
|---|---|---|
rgb_palettes |
Array.<Array.<Array.<number>>> | array of palettes, each palette is an array of RGB color arrays |
- Source:
Returns:
palette factory object
- Type
- PaletteFactory
(static) fromSanzoWadaArray(sanzo_palettes) → {PaletteFactory}
Create a palette factory from an array of Sanzo Wada colors
Parameters:
| Name | Type | Description |
|---|---|---|
sanzo_palettes |
Array.<Array.<Array.<string>>> | array of palettes, each palette is an array of Sanzo Wada color arrays |
- Source:
Returns:
palette factory object
- Type
- PaletteFactory