color-space

io.github.colorjs由 GitHub 帳號 colorjs 發布v3.5.0更新於 Oct 24, 2026

Conversions across 221 color spaces, tested against cited sources: CSS strings, gamut, LUTs

已驗證STDIO僅桌面開發者工具媒體與設計

概覽

AI 產生的概覽

本機 MCP 伺服器,提供經來源驗證的色彩空間運算,讓助理在 221 個色彩空間之間轉換顏色、檢查色域,並產生 CSS、著色器、LUT 或 ICC 設定檔。

可以做什麼
  • 在 221 個互通的色彩空間之間轉換顏色,輸入可為 CSS 字串或通道數值
  • 檢查色域並檢視色彩空間中繼資料,例如通道範圍與出處
  • 解析與格式化 CSS 顏色、混色、計算 deltaE 與 WCAG 對比度、模擬色覺缺陷
  • 產生 GLSL、WGSL、HLSL 或 MSL 著色器程式碼,以及對應的 JS 呼叫與色彩科學等價寫法
  • 輸出 .cube LUT、ICC 設定檔與 OpenColorIO 色彩空間,供調色與 DCC 工具使用
適用情境
適合需要精確、經來源驗證的色彩換算而非估算數值的任務:網頁與 CSS 顏色、廣色域與 HDR 影片流程、攝影機 Log 素材、印刷,或產生著色器與 LUT 資源。
執行需求
透過 npx 以 stdio 在本機執行,需要 Node.js;未宣告驗證、環境變數或請求標頭。也可在 localhost 啟動選用的 HTTP 模式,或建置 Docker 映像。
安裝前請注意
工具為唯讀的轉換與程式碼產生,不涉及憑證或付費。產生的著色器、LUT、ICC 與 OCIO 輸出在投入正式流程前應先檢查;HLSL/MSL 路徑需要選用的同儕套件。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 color-space,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

color-space [test] [npm] [size] [VS Code]

[the Ostwald hue circle at full color, shown continuously and in ten steps]

Open collection of color spaces.

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

Atlas →

Use

js
import space from 'color-space';
space.rgb.oklch(255, 128, 0);        // → [0.732, 0.186, 53] — modern CSSspace.slog3.rec2020(0.5, 0.5, 0.5);  // camera log → UHD wide gamutspace.rgb.xyz(300, -10, 0);          // → [59.7, 30.6, 2.8] — out-of-range in, unclamped out
// batchspace.rgb.oklch([255, 128, 0,  0, 255, 128]); // [0.732, 0.186, 53,  0.875, 0.234, 151]
// metaspace.lab.range;                     // [[0, 100], [-125, 125], [-125, 125]]

Individual spaces:

js
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
  • 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, 55 spaces, each checked against the library to 1e-6
  • 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
  • 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?

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.

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

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

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.

LibrarySpacesRangesCamera log · CAM · historicBackends
color-space221Conventional✅JS · WASM · GLSL/WGSL · LUT · ICC
color-space/lite54Conventionallogs · HDR · CAM16JS · 29 kB gzip
color-space/wasm54Conventionallogs · HDR · CAM16WASM
culori300–1❌JS
colorjs.io510–1someJS
texel/color~160–1❌JS
chroma-js11mixed❌JS
d3-color6mixed❌JS

CC0 · ॐ

來源:README.md,提交 d572b38

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

2
  1. v3.5.0最新Oct 20, 2026
  2. v3.3.0Oct 15, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分