UNPKG

@opendatasoft/visualizations

Version:

Opendatasoft's components to easily build dashboards and visualizations.

19 lines (14 loc) 489 B
import type { Color } from 'types'; export const DEFAULT_GREY_COLOR = '#F0F0F0'; export function defaultValue<T>(value: T | undefined, fallback: T): T { if (value === undefined) return fallback; return value; } export function singleChartJsColor(color?: Color | Color[]) { if (color === undefined) return undefined; if (typeof color === 'string') return color; return color[0]; } export function multipleChartJsColors(color?: Color | Color[]) { return color; }