Skip to content

color.palette.chartjs

Summary

color.palette.chartjs supplies seven categorical chart swatches. Use it to assign the same ordered colors to a series in a plot and its legend. Sample at texel centers for a direct mapping from category index to swatch.

Syntax

chartjs(): Colormap
const palette = WasmGPU.color.palette.chartjs();

Returns

Colormap - Shared nearest-filtered map with seven texels, beginning with blue. Equivalent to WasmGPU.color.palette.builtin("chartjs").

Example

import WasmGPU from "@zushah/wasmgpu";

const palette = WasmGPU.color.palette.chartjs();
const colors = Array.from({ length: palette.width }, (_, i) =>
    palette.sampleCPU((i + 0.5) / palette.width)
);

See Also