Styling colors
You can customize the chart's color palette during initialization or dynamically through the API.
Set colors on initialization
export const changeColors = () => {const config: PartialChartConfig = {colors: {/* <your colors here> */},};const element: HTMLElement = document.createElement('div');const chart = new Chart(element, config);return chart;}
Update colors via API
export const setColors = () => {const colors = {/* <your colors here> */};const element: HTMLElement = document.createElement('div');const chart = new Chart(element);chart.setColors(colors);return chart;}
Color configuration reference
The colors
object defines the full chart color schema: