ia.ColorPalette Class
Palette for colors.
Constructor
ia.ColorPalette
-
c
Parameters:
-
cStringA list of colors.
Methods
addColor
-
c
Adds a color to this ia.ColorPalette.
Parameters:
-
cStringThe name of the color.
getColor
-
f
Gets the color corresponding to the interpolation fraction.
Parameters:
-
fNumberAn interpolation fraction as a value between 0 and 1.
Returns:
getColorAtIndex
-
index
Gets the color at the given index into the palette.
Parameters:
-
indexNumberthe Index of the color
Returns:
getColorList
()
String
Gets the list of colors.
Returns:
getColors
-
numberOfColors
Returns the list of colors. If more colors are requested than are contained in the palette, random colours are generated to complete the list.
Parameters:
-
numberOfColorsNumberThe number of colors required.
Returns:
getInterpolatedColors
-
numberOfColors
Returns a list of colors uniformly interpolated
from the color property list. If only one color is requested it
will be interpolated from the center of the color property list.
If two colors are requested the first and last
colors in the color property list will be returned.
Parameters:
-
numberOfColorsNumberThe number of colors required.
Returns:
getMatchingColors
-
values
Returns the colors that are matched against the given values
in the matchColorsToValues hash.
If no match is found the next color in the palette is used.
If more colors are requested than are contained in the palette, random colours are generated to complete the list.
Parameters:
-
valuesStringThe values array.
Returns:
setColorAtIndex
-
index -
c
Sets the color at the given index into the palette.
Parameters:
-
indexNumberThe index of the color
-
cStringThe name of the color.
setColorList
-
value
Sets the list of colors.
Parameters:
-
valueStringThe color list.
Properties
CATEGORY_COLORS
String
final
static
A set of 20 colors for categoric color schemes.
Default: [ '#B4371F', '#FFBB78', '#2CA02C','#98DF8A', '#D62728', '#FF9896', '#9467BD', '#C5B0D5', '#8C564B', '#C49C94', '#E377C2', '#F7B6D2', '#7F7F7F', '#C7C7C7', '#BCBD22','#DBDB8D', '#17BECF', '#9EDAE5', '#AEC7E8', '#9EDAE5' ]
id
String
The id of the palette.
Default: ""
matchColorsToValues
Associative Array
A hash that matches colors to values. The key is the value to match against - the value is the color.
NUMERIC_COLORS
String
final
static
A blue numeric color scheme.
Default: ['#ece7f2', '#74a9cf', '#023858']