import { ChartType , ScriptableContext } from 'chart.js' ; import { ColorHelper } from '../../../helpers' ; import { ChartDataset } from '../chart.types' ; const { getThemeColorHexString } = ColorHelper ; export const hoverBackgroundColor = getThemeColorHexString ( 'primary' ) ; export const backgroundColor = getThemeColorHexString ( 'secondary' ) ; export function scriptedBackgroundColor ( context ) { const dataset = context . dataset as ChartDataset ; const highlightedElements = dataset ?. kirbyOptions ?. highlightedElements ; if ( highlightedElements && highlightedElements . includes ( context . dataIndex ) ) { return hoverBackgroundColor ; } else { return backgroundColor ; } } export function scriptedHoverBackgroundColor ( context ) { if ( context . chart . options . onClick ) { return hoverBackgroundColor ; } }