Component-Specific

useChartColors

Manage color palettes and themes for chart components with dynamic color generation.

import { useChartColors } from "saha-ui"

Uses

Provide palette arrays and helper getters for chart color management across chart variants (default, primary, success, etc.).

Props

NameTypeDescriptionDefault
variantstringPalette variant e.g. "default"."default"

Returns

NameDescription
colorsArray of color strings (OKLCH values in this codebase).
getColor(index)Returns color at index modulo palette length.
getPalette()Returns the full palette.

Example

const { colors, getColor } = useChartColors('primary'); const stroke = getColor(0);

Notes

Palettes use perceptual color strings (OKLCH) for consistent gradients and accessible palettes.
Saha UI - The Modern React Component Library