> ## Documentation Index
> Fetch the complete documentation index at: https://anvil.servicetitan.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Categorical palette

> Compose out-of-order categorical hues for @servicetitan/anvil2-rn-charts-kit.

Themes assign categorical color by series or datum index. Compose with `chartPalette` to reach a hue outside that order, selecting from the Anvil2 list rather than authoring hex values.

* Design: [Categorical color palette](/docs/web/data-visualization/categorical-color-palette)
* Shared API: [Chart component](/docs/kits/charts-react-native/chart)

Select hues by index into the array. The array holds the Anvil2 order, so the choice is which entry to use rather than which hex value to write:

```tsx theme={null}
const colors = chartPalette(appearance, "categorical");
// e.g. use purple (index 2) before blue (index 0):
series: [
  { type: "line", name: "A", data: […], itemStyle: { color: colors[2] } },
  { type: "line", name: "B", data: […], itemStyle: { color: colors[0] } },
];
```

Avoid hard-coding Anvil2 hex values in a chart option. Resolving through `chartPalette` keeps the light and dark appearances correct as tokens change.

***
