Chart Color Audit

io.github.socraticstatic由 GitHub 帳號 socraticstatic 發布v0.2.5更新於 Nov 1, 2026

CI-friendly accessibility audit for chart color palettes: WCAG contrast, CVD simulation, OKLab ΔE.

發布方自己的服務:audit.domains - Domain Valuation

已驗證STDIO僅桌面開發者工具資料與分析

概覽

AI 產生的概覽

稽核圖表配色對色盲使用者的區辨度與 WCAG 對比度,讓助理以量測數據而非主觀判斷評估調色盤。

可以做什麼
  • 稽核貼上的配色:模擬綠色盲、紅色盲、藍色盲與全色盲,量測 OKLab 兩兩色差及相對於背景的對比度
  • 稽核設定檔中的設計權杖:從 CSS 自訂屬性或多設計權杖 JSON 讀取資料系列、語意色與文字色,並列出具名問題
  • 回傳每種視覺模擬下的最小色差、最接近的一對、分級區間,以及通過或失敗結論與可讀的失敗原因
適用情境
適合在挑選或審查儀表板、圖表配色時使用,需要以量測結果回答資料系列對色盲使用者是否仍可區辨、是否達到對比度下限,而不是憑感覺判斷。
執行需求
透過 npx 從 npm 套件 chart-color-audit 以 stdio 在本機執行;未宣告驗證、環境變數或請求標頭。權杖稽核需讀取 chartaudit.config.json 等設定檔,並指向 CSS 或 design-tokens 檔案。稽核本身不需要網路存取。
安裝前請注意
兩個工具被描述為唯讀,但權杖稽核會讀取所指專案中的檔案,因此只應指向願意讓助理存取的儲存庫。它只稽核宣告的顏色,不渲染圖表,也不檢查實際像素。

安裝

在 SourceWeft 中

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

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

其他 MCP 客戶端

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

README

chart-color-audit

Accessibility audit for chart color palettes. Answers one question with math: can everyone still tell your data series apart?

Plenty of tools check text contrast. This one checks the thing dashboards actually break: whether your palette survives colorblindness. It simulates deuteranopia, protanopia, and tritanopia with the published Machado, Oliveira & Fernandes 2009 matrices, measures pairwise separation in OKLab, checks WCAG 2.2 contrast against your background, and fails your build when a change quietly breaks any of it.

Four ways in. Pick yours.

you areyou wantgo to
a designer with a palette in handa verdict right now, nothing installed1 · Try a palette
a team with tokens in a repothe build to fail when a color change breaks accessibility2 · Gate your CI
an engineer building toolingthe audit as a typed function3 · Call it from code
working with Claude or another agentthe audit as an MCP tool4 · Wire it into an agent

1 · Try a palette (nothing to install)

bash
npx chart-color-audit --colors "#4E79A7,#F28E2B,#E15759" --bg "#fff"
chart-color-audit · 3 colors on #ffffff · mode: perceptual
  vision          min ΔE   closest pair   reading  · normal          14.6   2 ↔ 3        clearly distinct  · deutan          11.9   2 ↔ 3        clearly distinct  · protan          11.9   1 ↔ 3        clearly distinct  · tritan          10.3   2 ↔ 3        clearly distinct  · achromatopsia    5.2   1 ↔ 3        distinguishable
  contrast vs background: worst 2.42:1 (slot 2, needs ≥ 3:1)  ✗ slot 2 #f28e2b — 2.42:1
  FAIL — 1 finding:    · contrast: slot 2 (#f28e2b) is 2.42:1 vs. background (needs ≥ 3:1, WCAG 2.2 SC 1.4.11).

Those three colors separate cleanly under every colorblind simulation. The orange still fails: 2.42:1 against white, below the 3:1 floor for chart marks. Pale bars on white is one of the oldest dashboard sins, and this is it, caught in numbers.

Exit codes: 0 pass, 1 fail, 2 bad input. That is the whole CI contract.

Reading the output

ΔE is perceptual color distance (OKLab × 100). About 2 is the edge of what a human eye can tell apart.

readingmin ΔEmeaning
clearly distinct≥ 10survives a projector and a hallway glance
distinguishable≥ 2a careful reader separates the series
patterns carry identity< 2color alone is not enough; dash/shape must carry it
COLLISION≈ 0–1two series are the same color for these viewers

closest pair names the two slots (1-based) that came nearest. Fix those two, re-run, repeat.

CLI

bash
npx chart-color-audit --colors <list> --bg <color> [options]npx chart-color-audit [--config chartaudit.config.json]npx chart-color-audit mcp
flagwhat it does
--colors <list>comma-separated palette, any CSS color syntax: hex, hsl(), rgb(), oklch(), named, raw triples ("222 47% 6%")
--bg <color>background the marks render on
--mode <mode>perceptual (default) · redundant-encodings · strict (see Floors)
--config <path>config file, default ./chartaudit.config.json
--jsonfull result as JSON: verdict, failures[], perVision[], contrast[], semantic[], text[]
--version, --helpthe usual

2 · Gate your CI

Two files, no dependencies added.

Step 1. Put chartaudit.config.json in your repo root, pointed at the tokens you already have:

jsonc
{  // Where your tokens live: a .css file (custom properties) or a  // W3C design-tokens .json file. Optional; you can also write  // literal colors directly in the fields below.  "tokens": "src/index.css",
  // CSS selector whose block holds the variables. Optional, default ":root".  "selector": ":root",
  // REQUIRED. Your data-series colors, in slot order.  // Each entry is a literal ("#4E79A7"), a CSS variable name from the  // tokens file ("--chart-cat-1"), or a dotted path into design-tokens  // JSON ("chart.categorical.1").  "categorical": ["--chart-cat-1", "--chart-cat-2", "--chart-cat-3"],
  // REQUIRED. The background your marks render on.  "background": "--chart-bg",
  // Optional. Status colors, checked at 3:1 vs the background AND for  // collisions against the palette: the classic silent failure where a  // "positive" green KPI reads as data series 3 for deutan viewers.  // Verdict semantics: "low-contrast" and "collision" FAIL the audit;  // "cvd-risk" (collides with a slot only under CVD simulation) is  // REPORTED but does not fail — semantic roles usually carry redundant  // cues (position, icon, label). Treat cvd-risk as a review prompt.  "semantic": { "positive": "--chart-positive", "muted": "--chart-muted" },
  // Optional. Tokens rendered as UI text (status labels, captions, table  // numbers). Text needs 4.5:1 (SC 1.4.3), not the 3:1 mark floor.  // Reusing mark tokens as text is the most common failure I have shipped:  // one measured sweep found 111 instances of it in a single app.  "text": { "positive": "--chart-positive-text" },
  // Optional. Floors preset, and per-floor overrides on top of it.  "mode": "perceptual",  "floors": { "minContrast": 3, "minTextContrast": 4.5 }}

Step 2. Add the workflow:

yaml
# .github/workflows/chart-colors.ymlon: [push, pull_request]jobs:  chart-colors:    runs-on: ubuntu-latest    steps:      - uses: actions/checkout@v4      - run: npx chart-color-audit

Done. A token edit that breaks a floor now exits 1 with named findings, in the PR, before anyone screenshots anything.

Prefer a pinned dependency? npm i -D chart-color-audit and call it from a package script. Same behavior.

The famous-palette test

bash
npx chart-color-audit --colors "#4E79A7,#F28E2B,#E15759,#76B7B2,#59A14F,#EDC948,#B07AA1,#FF9DA7,#9C755F,#BAB0AC" --bg "#fff"

That is Tableau 10, one of the most-shipped chart palettes on earth, on a white dashboard:

  ✗ deutan           0.7   3 ↔ 5        COLLISION  ✗ protan           0.9   4 ↔ 10       COLLISION  ✗ achromatopsia    1.6   2 ↔ 4        COLLISION  ...  FAIL — 8 findings

Its red and green sit ΔE 0.7 apart under deuteranopia simulation. Roughly 1 in 12 men has red-green color vision deficiency; for most of them, series 3 and series 5 on that chart are the same color. Nothing in code review catches this. Math does.

3 · Call it from code

bash
npm i chart-color-audit
ts
import { audit } from "chart-color-audit";
const result = audit({  colors: ["#4E79A7", "#F28E2B", "#E15759"],  background: "#ffffff",  // optional: semanticRoles, textRoles, mode, floors});
result.verdict;   // "pass" | "fail"result.failures;  // human-readable reasons, empty on passresult.perVision; // per simulation: minDeltaE, closestPair, band

Fully typed. Two data dependencies (culori for color math, the MCP SDK for the server). No DOM, no network.

4 · Wire it into an agent (MCP)

Let an agent audit colors mid-conversation:

bash
claude mcp add chart-color-audit -- npx chart-color-audit mcp

Two read-only tools: audit_palette (paste colors) and audit_tokens (point at a config). Ask "is this palette colorblind-safe on white?" and the answer comes back with measurements instead of vibes.

Listed in the official MCP Registry as io.github.socraticstatic/chart-color-audit and on Glama.

Floors

modefails whenfor
perceptual (default)any pair lands below ΔE 2, the edge of human perception, under any simulation; or contrast < 3:1palettes where color alone carries identity
redundant-encodingsoutright collision only (ΔE < 1 normal / < 0.1 CVD)design systems pairing every color with a dash/decal/shape channel
strictbelow ΔE 10 normal / ΔE 4 CVDcontrol rooms, projectors, hallway glances

Text tokens are checked at 4.5:1 in every mode. Changing default floors is a major version, always: a CI gate that tightens defaults in a patch release breaks builds and trust.

Honest scope

Tokens in, findings out. This audits declared palette colors. It does not render charts, screenshot pixels, or crawl pages. Contrast checkers for text exist in plenty; what this adds is the part I could not find anywhere else: CVD-simulated series separation, as a build gate and an MCP tool.

Where this came from

The engine was extracted from a chart color system whose own history proves the point: an "accuracy fix" commit once replaced the correct deuteranopia matrix with confident, plausible, fabricated values, and review passed it. Only a pinned regression test would have caught it, so this package pins the matrices against the published paper in its test suite, permanently.

The full story: docs/POSTMORTEM.md: nine weeks of a wrong matrix, the AI-co-authored commit that forged it, and why the math now checks the math.

Consulting

I audit dashboards and design systems for exactly these failures. 30 years of UX practice, and the math above to prove findings instead of arguing them. [email protected]

MIT © Micah Boswell

來源:README.md,提交 5624266

工具

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

版本歷史

2
  1. v0.2.5最新Oct 4, 2026
  2. v0.2.4Sep 16, 2026

評分

已滿足適用檢查項的 50%

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

  • 近 30 天內可連通25 分

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

  • 已宣告認證方式10 分

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

  • 已列出工具15 分

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

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

其他 Audit 整合