colors: Array
Colors for the chart’s series. When all colors of the array are used, it starts from the beginning
{
colors: ['#546E7A', '#E91E63'];
}
Predefined colors are available in theme palettes
Note: You should only provide either hex
or rgb/rgba
format. Color names are not accepted at the moment.
Also, if you are rendering a bar/pie/donut/radialBar chart, you can pass a function which returns color based on the value.
colors: [function({ value, seriesIndex, w }) {
if (value < 55) {
return '#7E36AF'
} else {
return '#D9534F'
}
}, function({ value, seriesIndex, w }) {
if (value < 111) {
return '#7E36AF'
} else {
return '#D9534F'
}
}]
/* */
Note: Note that the number of items in colors array should be equal to number of series if you intend to provide a function for it.
If, for some reason, your legend and tooltip colors stop showing, you can use tooltip.marker.fillColors
& legend.markers.fillColors