Conversions across 221 color spaces, tested against cited sources: CSS strings, gamut, LUTs
Open collection of color spaces.
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)
color-space – All 205 interconnected spaces · 55 kB gzipcolor-space/<name>.js – One standalone spacecolor-space/lite – 54-space working set · 29 kB gzipcolor-space/wasm – lite set as WASM · bare .wasm includedcolor-space/gl – GLSL/WGSL shader sourcecolor-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 ACEScolor-space/icc – Matrix + TRC or CLUT profilescolor-space/data.json – Channels, ranges, provenance, references, graph, gamutsnpx color-space rgb oklch 255 128 0 – CLI, no install: convert (default) · cube · icc · space · spaces · mcp (MCP server for agents)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.
A complete collection of color spaces: one minimal API, verified formulas. While alternatives focus on digital color spaces, this project takes broader perspective, covering historical and cross-disciplinary spaces as well. Side effects: corrected papers, color education, test cases for JS→WASM compilers (porffor, jz).
It is not a color toolbox — parsing, interpolation, ΔE, gamut mapping, contrast, palettes, alpha stay out. Pantone, NCS, RAL Classic, and similar licensed swatch catalogs aren't open and stay out as well.
Thanks to the researchers, theorists, specifiers, implementors and the libraries that helped this one happen.
| Library | Spaces | Ranges | Camera log · CAM · historic | Backends | Speed (M op/s)¹ |
|---|---|---|---|---|---|
| color-space | 205 | Conventional | ✅ | JS · WASM · GLSL/WGSL · LUT · ICC | 5.52 |
| color-space/lite | 54 | Conventional | logs · HDR · CAM16 | JS · 29 kB gzip | 3.01 ² |
| color-space/wasm | 54 | Conventional | logs · HDR · CAM16 | WASM | 1.38–4.78× JS batches ³ |
| culori | 30 | 0–1 | ❌ | JS | 4.46 |
| colorjs.io | ~40 | 0–1 | some | JS | 0.23 |
| texel/color | ~16 | 0–1 | ❌ | JS | 3.49 ² |
| chroma-js | ~12 | mixed | ❌ | JS | 1.19 ² |
| d3-color | 6 | mixed | ❌ | JS | 9.35 ² |
¹ geometric mean, million scalar calls per second over the 7 shared npm run benchmark conversions (rgb ⇄ lab · hsl · oklab, rgb → p3), inputs rotating through a 256-color table; median of 3 runs on 2026-10-03 as the benchmark prints it, Node 22.22 / Intel Xeon 2.1 GHz (4 vCPU), culori 4.0.2 · colorjs.io 0.5.2 · @texel/color 1.1.11 · chroma-js 3.2.0 · d3-color 3.1.0. Absolute figures move with the machine; the ratios are the claim · ² measured on the subset it implements — color-space on the same subset: lite's 4 (lab, oklab; measured before lite gained hsl and p3) 3.09 · texel's 3 (oklab, p3) 2.76 · chroma-js's 6 6.45 · d3-color's 4 (lab, hsl) 9.28 · ³ WASM speedup over the JS batch API, rgb → each of the 26 targets it had then over 1M pixels (the 27 added since are not yet measured), per-target medians of 3 further runs the same day (lowest on Jzazbz and JzCzHz)
Source-derived launch command. Check the maintainer’s required arguments and credentials before running:
npx -y color-spaceMerge this template into ~/Library/Application Support/Claude/claude_desktop_config.json. Keep existing servers. Add any arguments, credentials, and permissions required by the maintainer; this template has not been install-tested.
{
"mcpServers": {
"io-github-colorjs-color-space": {
"command": "npx",
"args": [
"-y",
"color-space"
]
}
}
}Restart Claude Desktop completely for changes to take effect. Confirm the server appears connected in the client’s tool list, then try a read-only example from its documentation.
Claude Desktop setup referencecolor-space works with any MCP-compatible client. Copy the config snippet from the Configuration section above and add it to the file shown for your client, then restart the application.
~/Library/Application Support/Claude/claude_desktop_config.jsonRestart Claude Desktop completely for changes to take effect.~/.cursor/mcp.jsonRestart Cursor for changes to take effect..vscode/mcp.jsonReload VS Code window for changes to take effect.~/.codeium/windsurf/mcp_config.jsonRestart Windsurf for changes to take effect..mcp.jsonSave at the project root, then start Claude Code in that project and review the MCP server approval prompt. Keep real credentials out of shared files.