ContrastKit

对照 WCAG 2.x AA 和 AAA 检查文本与背景颜色,获取最接近的无障碍颜色,转换 CSS 颜色,并检查最多 12 种颜色的整个调色板。免费,无需注册,无需 API 密钥;每个 IP 每分钟约 60 次检查。您提交的任何内容都不会被存储。ContrastKit 与 W3C 或 WebAIM 无关联。

托管 MCP 服务器

npx add-mcp 'https://contrastkit.mike-tusa.workers.dev/mcp'

可安装到 Claude Code、Codex、Cursor 等客户端

文档

ContrastKit

Check a text color against its background for WCAG AA and AAA, and get the closest color that passes if it doesn't. Hex, rgb(), hsl() and color names all work. Nothing you type is stored.

How it's measured

Contrast ratio = (L1 + 0.05) / (L2 + 0.05) with WCAG 2.x relative luminance (sRGB). Levels: aa 4.5:1, aa-large 3:1, aaa 7:1, aaa-large 4.5:1, ui 3:1 (aa = SC 1.4.3 normal text, aa-large = 18pt / 14pt bold text, aaa = SC 1.4.6, ui = SC 1.4.11 non-text). Ratios are floored to 2 decimals and pass/fail uses the exact value, so 4.499:1 fails AA. A translucent foreground is blended over the background; a translucent background is blended over white. See WCAG 2.2 success criterion 1.4.3.

Colors: #rgb, #rgba, #rrggbb, #rrggbbaa (the # may be omitted; URL-encode it as %23), rgb()/rgba() and hsl()/hsla() in comma or space syntax with optional alpha (0-1 or %), the 148 CSS color names and transparent. Max 64 characters per color. Not supported: lab(), lch(), oklch(), color(), currentColor, system colors.

JSON API

curl -s 'https://contrastkit.mike-tusa.workers.dev/api/contrast?fg=%23777777&bg=%23ffffff'
curl -s 'https://contrastkit.mike-tusa.workers.dev/api/suggest?fg=%23777777&bg=%23ffffff&level=aa'

Routes: /api/contrast, /api/suggest, /api/convert and /api/palette (up to 12 colors). No key needed: about 60 requests per minute per IP. OpenAPI 3.1 spec

For AI agents

ContrastKit is also a remote Model Context Protocol (MCP) server with four read-only tools: check_contrast, suggest_accessible_color, convert_color and check_palette. Works with AI agents and assistants that can call an MCP server or a JSON API, for example Muse, Claude, ChatGPT or Cursor (descriptive only). Most MCP clients accept this config; some use a different format (for example, VS Code uses a servers key).

{ "mcpServers": { "contrastkit": { "type": "http", "url": "https://contrastkit.mike-tusa.workers.dev/mcp" } } }

Machine-readable docs: llms.txt · OpenAPI 3.1 spec · MCP server card. ContrastKit is not affiliated with, endorsed by or sponsored by the W3C, WebAIM, Meta, Anthropic, OpenAI or Anysphere. WCAG is a W3C standard; a passing ratio is one part of accessibility, not a full audit.