// readme

color-space

Open collection of color spaces.

  • Formulas tested against cited sources
  • Conventional ranges
  • JS with TypeScript types / WASM / GLSL / LUT / ICC / OCIO

Atlas โ†’

Use

import space from 'color-space';

space.rgb.oklch(255, 128, 0);        // โ†’ [0.732, 0.186, 53] โ€” modern CSS
space.slog3.rec2020(0.5, 0.5, 0.5);  // camera log โ†’ UHD wide gamut
space.rgb.xyz(300, -10, 0);          // โ†’ [59.7, 30.6, 2.8] โ€” out-of-range in, unclamped out

// batch
space.rgb.oklch([255, 128, 0,  0, 255, 128]); // [0.732, 0.186, 53,  0.875, 0.234, 151]

// meta
space.lab.range;                     // [[0, 100], [-125, 125], [-125, 125]]

Individual spaces:

import oklch from 'color-space/oklch.js';
oklch.rgb(0.65, 0.25, 180);          // matches CSS oklch(0.65 0.25 180)

Imports

  • color-space โ€“ All 221 interconnected spaces. 70 kB gzip
  • color-space/<name>.js โ€“ One standalone space *โ€ฆ