Extends
- React.Component
Members
getAddColorCell
Creates the JSX for the add color cell. If the internal ColorPalette's colors array is full, returns null instead.
- Source:
getColorCells
Creates the JSX for all of the color select buttons.
- Source:
handlePickerChange
Handles color picker change.
- Source:
onAddCellClick
Handles when the add cell button is clicked.
- Source:
onColorCellClick
Updates the currently selected color cell to the given id
- Source:
updateColorData
Checks for changes in color data from the onGetColorData() prop. If there are any, updates the state.
- Source:
Methods
addColor(ropt, gopt, bopt)
Adds a new color to the end of the colors array. Red by default.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
r |
number |
<optional> |
1 | |
g |
number |
<optional> |
0 | |
b |
number |
<optional> |
0 |
- Source:
getColorAtIndex(index) → {Color}
Returns the color at the given index.
Parameters:
Name | Type | Description |
---|---|---|
index |
number |
- Source:
Returns:
The color at the index. Null if not found
- Type
- Color
getColorsArray() → {Array.Color}
Returns the array of colors currently in the palette.
- Source:
Returns:
- Type
- Array.Color
getSelectedColor() → {Color}
Returns the currently selected color.
- Source:
Returns:
- Type
- Color
getSelectedColorIndex() → {number}
Returns the index of the selected color.
- Source:
Returns:
- Type
- number
isColorsFull() → {boolean}
Checks if the colors array is full. True if it is. False otherwise.
- Source:
Returns:
- Type
- boolean
restoreDefaults()
Sets the color palette to its default settings.
- Source:
setColorAtIndex(index, r, g, b)
Sets the color at the given index to the given r, g, b values.
Parameters:
Name | Type | Description |
---|---|---|
index |
number | |
r |
number | |
g |
number | |
b |
number |
- Source:
setNewColorsArray(newColors)
Creates a new color array from the new one.
Parameters:
Name | Type | Description |
---|---|---|
newColors |
Array |
- Source:
setSelectedColor(index)
Changes the currently selected color to another within the colors array.
Parameters:
Name | Type | Description |
---|---|---|
index |
number |
- Source: