PeakUIPro

Colors

The chart ramp Pro derives from your accent, and how to override it

The color system is the core's — the same semantic roles, the same -foreground pairs, the same theme switching. Pro adds one thing of its own: a five-step ramp for charts.

Every role, with a plate per token, is on Colors.

The Chart Ramp

A chart series takes its color as a value — AreaChart.Area, KPI.Chart and the rest — and the five variables below are what you give it. They are derived from your theme's accent, so a series wired to one of them is in your brand without a palette of its own:

:root,
:host,
[data-theme] {
  --chart-1: oklch(from var(--accent) calc(l - 0.24) c h);
  --chart-2: oklch(from var(--accent) calc(l - 0.12) c h);
  --chart-3: var(--accent);
  --chart-4: oklch(from var(--accent) calc(l + 0.12) c h);
  --chart-5: oklch(from var(--accent) calc(l + 0.24) c h);
}

--chart-3 is the accent itself, with two darker steps below it and two lighter above.

Nothing is applied for you: a series left alone draws in currentColor. Name the variable on the part, and from then on changing --accent moves every series that points at the ramp.

<AreaChart data={data}>
  <AreaChart.Area dataKey="requests" stroke="var(--chart-3)" />
  <AreaChart.Area dataKey="errors" stroke="var(--chart-5)" />
</AreaChart>

Declared on Every Themed Element

The ramp is declared on :root, :host and [data-theme] together, not on the root alone. A custom property that calls var() resolves where it is declared, so a ramp declared only at the root would carry the root's accent into a subtree that set its own theme.

{/* The ramp inside resolves from this section's accent, not the page's. */}
<section data-theme="default-dark" style={{"--accent": "oklch(0.55 0.21 295)"}}>
  <AreaChart data={data}>
    <AreaChart.Area dataKey="requests" stroke="var(--chart-3)" />
  </AreaChart>
</section>

Tailwind Utilities

The five are bridged into Tailwind, so they reach your own markup as well.

<span className="bg-chart-3" />
<span className="text-chart-1" />

Forced Colors

Under forced-colors the ramp falls back to system colors, and the only promise it keeps is that a series is visible against Canvas. Five series cannot be told apart by color there — in this library or any other — so a chart that must stay readable gives its series a shape or a label too.

Overriding the Ramp

Declare the five yourself and the derivation steps aside. Declare them wherever the library does — on :root for the page, and again on each [data-theme] you use, since the library's own declaration on a themed element beats one inherited from the root:

:root,
[data-theme="default-light"] {
  --chart-1: oklch(0.45 0.16 250);
  --chart-2: oklch(0.55 0.16 250);
  --chart-3: oklch(0.62 0.16 250);
  --chart-4: oklch(0.72 0.14 250);
  --chart-5: oklch(0.82 0.1 250);
}

[data-theme="default-dark"] {
  --chart-1: oklch(0.55 0.16 250);
  --chart-2: oklch(0.65 0.16 250);
  --chart-3: oklch(0.72 0.16 250);
  --chart-4: oklch(0.8 0.14 250);
  --chart-5: oklch(0.88 0.1 250);
}

Browsers Without Relative Colors

The ramp is built with relative colors, supported since 2024 in every major browser. Where they are not supported the five stay undefined and a series draws without a color — declare them yourself, as above, to support those browsers.

On this page