Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | import { globalOptions } from './settings'; import { ChartOptions } from './types'; export function getColor(key: string, index: number, chartOptions: ChartOptions): string | null { let color: string | null = null; if (chartOptions.colors) { if (Array.isArray(chartOptions.colors)) { if (chartOptions.colors.length > index) { color = chartOptions.colors[index]; } } else { color = chartOptions.colors[key]; } } if (!color) { if (globalOptions.color.length > index) { color = globalOptions.color[index]; } } return color; } |