Color Palettes

Color palette utilities are exported through COLOR_PALETTES and sampling helpers.

Basic Usage

import { COLOR_PALETTES, sampleColorPaletteById } from "@ska-octopus-widget-sdk/widget-sdk";

const ids = Object.keys(COLOR_PALETTES);
const colors = sampleColorPaletteById("scientificActon10", 12);

Helpers

  • sampleColorPaletteById(id, count)

  • samplePaletteColors(...)

  • sampleHexRamp(...)

  • linearRgbToSwatches(...)

Typical Patterns

  • Chart colorways from sampled palettes

  • Consistent per-trace colors across widgets

  • Converting scientific linear-RGB maps into SDK swatches