Skip to main content
Glama

color-space test npm size VS Code

Open collection of color spaces.

  • Formulas tested against cited sources – errata found in them

  • 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)

Related MCP server: MCP Color Converter

Imports

  • color-space – All 221 interconnected spaces. 70 kB gzip

  • color-space/<name>.js – One standalone space

  • color-space/lite – 54-space working set. 29 kB gzip

  • color-space/wasm – lite set as WASM, bare .wasm included

  • color-space/gl – GLSL/WGSL shader source

  • color-space/gl/hlsl · color-space/gl/msl – HLSL (DirectX, Unity, Unreal) and Metal, written by naga from the WGSL. await hlsl('rgb', 'oklch'). needs the optional peer naga-wasm (it declares Node ≥ 24.12; CI runs it on 22, where npm only warns)

  • color-space/lut – .cube LUTs for Resolve, Premiere, OBS, ffmpeg — verified vs ACES

  • color-space/icc – Matrix + TRC or CLUT profiles

  • color-space/ocio – OpenColorIO colorspaces for Blender, Nuke, Resolve, Houdini: colorspace(space.sgamut3cine), curve and matrix from native transforms, 58 spaces, each checked against the library to 1e-6; config(), or npx color-space ocio, is all of them as one config to point $OCIO at: color-space.ocio

  • color-space/util – parse, format CSS colors, mix, gamut, visible, deltaE, contrast (WCAG), cvd (color-vision simulation), deltaE('rgb', [255, 0, 0], [250, 0, 0])

  • color-space/data.json – Channels, ranges, provenance, references, graph, gamuts

  • color-space/conformance.json – Cited reference conversions, each with its source, to test any color library against: how to run it

  • npx color-space rgb oklch 255 128 0 – CLI, no install: convert (default), cube, icc, space, spaces, mcp (MCP server for agents)

Upgrading from v2?

MCP tools – convert, gamut, css, space, spaces, cube, shader, icc, code – so agents call verified math instead of guessing it. A color goes in as any CSS string ('#ff8000', 'oklch(0.7 0.1 50)', 'rebeccapurple') or as channel values; shader writes the conversion as GLSL, WGSL, HLSL or MSL, code gives the JS call and its verified colour-science equivalent.

claude mcp add color-space -- npx -y color-space mcp                                      # Claude Code
code --add-mcp '{"name":"color-space","command":"npx","args":["-y","color-space","mcp"]}'  # VS Code

Claude Desktop claude_desktop_config.json, any project .mcp.json:

{ "mcpServers": { "color-space": { "command": "npx", "args": ["-y", "color-space", "mcp"] } } }

Claude Code plugin (the server plus a skill): /plugin marketplace add colorjs/color-space, then /plugin install color-space@color-space. Docker: docker build -t color-space-mcp . and run it with docker run -i --rm color-space-mcp.

Over HTTP (Streamable HTTP, stateless): npx -y color-space mcp --http 8787 on localhost, or host fetch from color-space/mcp.js in a Worker, Deno or Bun. Skill for agents that load skills: plugins/claude/skills/color-space.

In the browser: color-space.io registers the same tools (but icc) through WebMCP where Chrome offers it, plus show, which opens a space's dossier or sets the page's color in front of the person.

Spaces

Display & web sRGB · Display P3 · Rec. 2020 · Linear-light sRGB · Rec. 709 · Rec. 709 display · sRGB 2.2 display · ProPhoto RGB · Adobe RGB (1998) · DCI-P3 · Linear Display P3 · Linear Rec. 2020 · Rec. 2020 display · Linear Adobe RGB (1998) · Linear ProPhoto RGB · scRGB · RIMM RGB · CIE RGB · NTSC RGB (1953) · PAL / SECAM RGB · Apple RGB · SMPTE-240M · ECI RGB v2 · Adobe Wide Gamut RGB · ColorMatch RGB · Bruce RGB · Beta RGB · Best RGB · Don RGB 4 · Ekta Space PS 5 · Russell RGB · Prismatic

Cylindrical HSL · HSV / HSB · HWB · HSI · IHLS · HCG · HCL · HSP · HCY · Cubehelix · HSM

Perceptual OKLCH · CIELAB · CAM16 · OKLab · HCT · Okhsl · Okhsv · Okhwb · OKLrAB · OKLrCH · SRLAB2 · proLab · sUCS · IgPgTg · HelmGen · HelmGen LCh · Helmlab MetricSpace · Jzazbz · JzCzHz · IPT · IPT Ragoo 2021 · Izazbz · hdr-IPT · IaPbP · CIELChab · CIELUV · HSLuv · CIELChuv · CIELAB D65 · CIELCh D65 · Msh · HPLuv · DIN99 · DIN99o Lab · DIN99o LCh · DIN99c · DIN99d · Log-compressed OSA-UCS · Hunter Lab · Hunter Rd,a,b · CIE 1960 UCS · CIE 1964 UVW · Adams–Nickerson Lab · hdr-CIELAB · CIECAM02 · CIECAM16 · CIECAM97s · CAM16-UCS · ZCAM · CAM02-UCS · CAM16-LCD · CAM16-SCD · CAM02-LCD · CAM02-SCD · Hellwig 2022 · Hellwig 2022 HK · ACES 2.0 JMh · sCAM · Kim 2009 · RLAB · LLAB · Nayatani 95 · Hunt · ATD95 · oRGB

Colorimetry & research CIE XYZ (D65) · CIE xyY · LMS · CIE XYZ (D50) · CIE 1976 u′v′ · CCT + Duv · Color temperature (Kelvin) · Maxwell triangle · Wavelength · Absolute XYZ D65 · LogLuv · MacLeod–Boynton · DKL · Grayscale · Dominant wavelength / DSH · rg chromaticity · Yrg (Kirk 2019) · XYB · OSA-UCS · TSL · YES · Ohta I₁I₂I₃ · lαβ · YyCxCz · Poirson–Wandell opponent

Video BT.709 Y′CbCr · ICtCp · ICtCp HLG · IPT-PQ-C2 · BT.2020 Y′CbCr · BT.601 525-line Y′CbCr · BT.601 625-line Y′CbCr · YCbCr (parameterized) · YUV · YIQ · YPbPr · YCgCo · JPEG YCbCr · YDbDr · YcCbcCrc · xvYCC · SMPTE-C · PhotoYCC · Rec. 2100 PQ · Rec. 2100 HLG · Linear Rec. 2100 · ICaCb · Y′D′zD′x

Camera ACEScg · ARRI LogC3 · ARRI Wide Gamut 3 · ACEScc · Sony S-Log3 · S-Gamut3 · Sony S-Gamut3.Cine · Venice S-Gamut3 · Venice S-Gamut3.Cine · ACES2065-1 · ACEScct · ARRI LogC4 · ARRI Wide Gamut 4 · Cineon · ADX10 · ADX16 · DaVinci Wide Gamut / Intermediate · DaVinci Wide Gamut · Sony S-Log2 · Panasonic V-Log · V-Gamut · RED Log3G10 · REDWideGamutRGB · Canon Log · Canon Log 2 · Canon Log 3 · DCI-P3+ · Fujifilm F-Log · Fujifilm F-Log2 · Fujifilm F-Log2 C · Nikon N-Log · Apple Log · Apple Log 2 · Blackmagic Film Gen 5 · Blackmagic Wide Gamut · DJI D-Log · D-Gamut · FilmLight T-Log / E-Gamut · E-Gamut · Kinefinity KineLOG3 · DCDM X′Y′Z′ · Sony S-Log · ACESproxy · ERIMM RGB · Leica L-Log · GoPro Protune · GoPro GP-Log2 · Insta360 I-Log · Xiaomi Mi-Log · OPPO O-Log · O-Log2 · Samsung Log · REDLog · REDLogFilm · RED Log3G12 · Panalog · ViperLog · Filmic Pro 6

Print CMYK · Munsell · RYB · CMY · RAL Design · Coloroid · Ostwald

Motivation

A complete collection of color spaces: one minimal API, formulas tested against their sources. While alternatives focus on digital color spaces, this project takes broader perspective, covering historical and cross-disciplinary spaces as well. Side effects: errata in papers, color education, test cases for JS→WASM compilers (porffor, jz).

It is not a color toolbox — gamut mapping, palettes, alpha stay out; the few tools the atlas itself uses (parsing, mixing, ΔE, contrast, color-vision simulation) are color-space/util. Pantone, NCS, RAL Classic, and similar licensed swatch catalogs aren't open and stay out as well.

Contributing

A wrong value or a missing space: open an issue with the document that defines it. How a space is added and checked: CONTRIBUTING.md.

Credits

Thanks to the researchers, theorists, specifiers, implementors and the libraries that helped this one happen.

Library

Spaces

Ranges

Camera log · CAM · historic

Backends

color-space

221

Conventional

✅

JS · WASM · GLSL/WGSL · LUT · ICC

color-space/lite

54

Conventional

logs · HDR · CAM16

JS · 29 kB gzip

color-space/wasm

54

Conventional

logs · HDR · CAM16

WASM

culori

30

0–1

❌

JS

colorjs.io

51

0–1

some

JS

texel/color

~16

0–1

❌

JS

chroma-js

11

mixed

❌

JS

d3-color

6

mixed

❌

JS

Available Tools

9 tools
codeLibrary codeA
Read-onlyIdempotent

The conversion as code to paste: the color-space JS call with its result and – where one exists for the space on the non-sRGB side – the colour-science (Python) equivalent verified against color-space (sRGB ↔ that space), with any named caveat. The color goes in as a CSS string or as values in from (default: sRGB 200, 100, 50).

Inputs: to (required), from, color, values. Returns: js, python, pythonFor

convertConvert colorA
Read-onlyIdempotent

Convert a color between any two of the 221 color spaces, identity included, in each space's conventional ranges (rgb 0-255, oklch L 0-1 / C 0-0.4 / H 0-360, lab L 0-100 …). The color goes in as a CSS string (color) or as channel values (from + values); a batch as colors – tuples in from, CSS strings, or both. Out-of-range in, unclamped out: inRange flags each channel against the target's conventional range (rgb below 0 means outside sRGB); null = undefined at that coordinate.

Inputs: to (required), from, color, colors, +1 more. Returns: to, from, colors, channels

cssCSS color stringsA
Read-onlyIdempotent

A color as CSS Color 4 strings — rgb(), hsl(), hwb(), lab(), lch(), oklab(), oklch() and color(display-p3 | a98-rgb | prophoto-rgb | rec2020 | srgb-linear | xyz-d65 | xyz-d50) — plus #hex inside sRGB. Converted, never gamut-mapped: a string is null where CSS would clamp it into a different color (rgb/hsl/hwb outside sRGB, lightness out of range). gamut is the smallest display gamut that holds the color.

Inputs: from, color, values, notations. Returns: css, hex, gamut

cube.cube LUTA
Read-onlyIdempotent

Render a conversion as a .cube LUT file (Resolve, Premiere, Final Cut, OBS, ffmpeg). The header carries the measured deviation vs the direct conversion. Pure per-channel transfers auto-emit 1D. Size ≤ 33 here (larger via the library or https://color-space.io/).

Inputs: to (required), from (required), size.

gamutGamut membershipA
Read-onlyIdempotent

Which standard display gamuts hold a color — sRGB ⊂ Display P3 ⊂ Rec. 2020, each tested in its own RGB box straight from the source space, the same ladder as the color-space.io gamut pill. smallest is the tightest one; null = beyond Rec. 2020. Membership only: nothing is gamut-mapped.

Inputs: from, color, values. Returns: gamuts, smallest

iccICC profileA
Read-onlyIdempotent

One space as an ICC v2 profile (.icc): matrix + tone curve where the space is an RGB working space (Photoshop, OS color management), a CLUT on a Lab PCS otherwise (lcms, ArgyllCMS, ImageMagick). Returned as a base64 embedded resource; class, pcs and bytes describe it.

Inputs: name (required), grid. Returns: pcs, file, name, bytes, +1 more

shaderShader codeA
Read-onlyIdempotent

The conversion as shader source – GLSL (WebGL2; WebGL1 too unless the path reads a table), WGSL (WebGPU), HLSL (DirectX, Unity, Unreal) or MSL (Metal) – with an entry function <from>_<to> (hyphens stripped), e.g. vec3 rgb_oklch(vec3 c), plus every function on the path. Each language is differentially tested against the library and compiled on real GPUs: use it instead of writing color matrices. HLSL and MSL need the optional peer naga-wasm installed beside color-space.

Inputs: to (required), from (required), language. Returns: code, entry, language

spaceSpace dossierB
Read-onlyIdempotent

The dossier of one color space: display name (as color-space.io shows it), description, channels + conventional ranges, defining references, provenance (year, author), illuminant/observer, encoding class, family and purpose, and its direct conversion neighbours.

Inputs: name (required). Returns: name, title, family, source, +3 more

spacesSpace catalogA
Read-onlyIdempotent

List the 221 color spaces with display name, family, purpose, channels and one-line use. Optional filters: query (words matched against id, name, use line and description; best matches first), family, purpose.

Inputs: query, family, purpose. Returns: count, spaces

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 9 tools

    Disambiguation4/5

    Each tool has a distinct primary output: raw conversion (convert), CSS strings (css), LUT file (cube), shader source (shader), ICC profile (icc), pasteable code (code), gamut membership (gamut), and space metadata (space/spaces). The only mild overlap is that convert, css, code, cube, shader, and icc all produce a conversion of a color, but the target format clearly separates them. Descriptions make the boundaries clear.

    Naming Consistency4/5

    All names are single lowercase tokens with no mixed casing or hyphenation, which is predictable and readable. It is not a strict verb_noun pattern (convert is a verb; the rest are nouns like space, cube, shader), and space/spaces differ only by pluralization, but overall style is consistent.

    Tool Count5/5

    Nine tools is well within a healthy range and each earns its place, covering distinct output formats and metadata queries without redundancy. The surface is neither thin nor bloated for a color-space library.

    Completeness4/5

    The surface covers conversion, gamut testing, CSS/LUT/shader/ICC/code emission, and full space metadata, which is strong lifecycle coverage for a color-space domain. Minor gaps exist (e.g. no color-difference/delta-E, interpolation, or blending operations), but core workflows are fully supported.

    Maintenance

    ActivityActive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Enables comprehensive color manipulation, conversion between 22+ formats (HEX, RGB, HSL, CMYK, LAB, etc.), palette generation, gradient creation, and accessibility compliance checking. Supports framework-specific outputs for CSS, Swift, Android, Flutter, and Tailwind with high-precision conversions and visualization capabilities.
      25
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides comprehensive color conversion, manipulation, analysis, and WCAG accessibility tools supporting multiple formats (hex, rgb, hsl, oklch, oklab) for design systems and web development.
      24 npm
      2
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Extract palettes from images, generate harmonies, gradients, random palettes; Check WCAG and APCA contrast; Suggest nearest passing OkLCH lightness; Simulate color-blindness; Convert and sort colors across formats (hex / RGB / HSL / OkLCH / …)
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Provides CSS color utilities including parsing, conversion, gamut mapping, WCAG contrast, tint/shade ramp generation, and contrast-target solving.
      6
      51 npm
      1
      MIT