一键导入
colors
Check color usage in your app (web or React Native) for accessibility compliance, including contrast, color-vision deficiencies, and sensory sensitivity.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Check color usage in your app (web or React Native) for accessibility compliance, including contrast, color-vision deficiencies, and sensory sensitivity.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
A skill that helps Flutter developers check the screen reader accessibility of their apps by analyzing the accessibility tree and providing feedback on potential issues.
A skill that helps React Native developers check the screen reader accessibility of their apps by analyzing the accessibility tree and providing feedback on potential issues.
A skill that helps developers and teams understand and justify the importance of accessibility to stakeholders, providing ethical, legal, and business arguments tailored to their context.
基于 SOC 职业分类
| name | colors |
| description | Check color usage in your app (web or React Native) for accessibility compliance, including contrast, color-vision deficiencies, and sensory sensitivity. |
| allowed-tools | Bash Read mcp__plugin_accessibility_contrast-calculator__calculate_contrast mcp__plugin_accessibility_contrast-calculator__batch_calculate_contrast |
| disable-model-invocation | true |
Structure your ENTIRE response using exactly the template below. Do NOT write any prose, explanation, or analysis outside of this structure. Fill each section in order. Do NOT reorder or rename sections. If a section has no violations, include it with its skip note — never omit a section entirely.
| Check | Status |
|---|---|
| Contrast (light theme) | ✅ Pass / ❌ Fail / ⚠️ Ambiguous |
| Contrast (dark theme) | ✅ Pass / ❌ Fail / ⚠️ Ambiguous |
| Color-only indicators | ✅ Pass / ❌ Fail |
| Sensory sensitivity | ✅ Pass / ❌ Fail |
Skip this section if all contrast checks passed.
Thresholds reminder:
| Text type | Web | React Native | Required ratio |
|---|---|---|---|
| Normal text | < 24px (or < 18.67px bold) | < 18pt (or < 14pt bold) | ≥ 4.5:1 |
| Large text | ≥ 24px (or ≥ 18.67px bold) | ≥ 18pt (or ≥ 14pt bold) | ≥ 3:1 |
| Disabled text | any | any | ≥ 3:1 |
| Focus indicator | web only | — | ≥ 3:1 |
| Element | Location | Text size | Foreground | Background | Ratio | Result |
|---|---|---|---|---|---|---|
<ComponentName> | path/to/file.tsx:42 | BOTH | #333333 | #FFFFFF | 12.6:1 | ✅ |
<ComponentName> | path/to/file.tsx:88 | SMALL | #AAAAAA | #FFFFFF | 2.3:1 | ❌ |
Ambiguous colors (cannot be analyzed):
path/to/file.tsx:55 — var(--color-primary) on var(--surface-bg): unresolved CSS custom propertiesSkip this section if no violations were found.
| Element | Location | Issue |
|---|---|---|
| Error message | path/to/file.tsx:102 | Error state indicated only by red text — no icon or label |
Skip this section if no violations were found.
| Element | Location | Issue |
|---|---|---|
| Banner | path/to/file.tsx:14 | Highly saturated color (#FF0000) used as background |
Would you like to know more about color accessibility or why accessibility matters? I can dive deeper into color guidelines using the colors skill, or explain the broader importance of accessibility with the why-accessibility skill.
These rules define when color usage in the application is considered accessible.
The guidelines align with WCAG 2.1 and include additional constraints for color-vision deficiencies and sensory sensitivity.
These rules define how the LLM must interpret color information before applying accessibility checks.
If the LLM cannot determine the actual rendered color value, it must not guess.
A color is considered ambiguous if any of the following is true:
var(--color-primary)) or design token whose value cannot be statically resolvedIf a color is ambiguous:
If a color is specified using a standard color name (e.g. black, white, red, blue, green):
The calculate_contrast and batch_calculate_contrast tools accept:
#rgb, #rrggbb, #rgba, #rrggbbaargb(255, 0, 0), rgba(255, 0, 0, 0.5)hsl(120, 50%, 50%), hsla(120, 50%, 50%, 0.8)Semi-transparent colors are automatically alpha-composited before contrast is computed:
Relative units (em, rem, %) and opacity CSS properties are not handled by the tool — the LLM must resolve them to absolute color values before calling the tool.
A contrast ratio is the ratio of perceived luminance between the foreground (text, icon, or control) and background (surface behind the foreground).
Always use the calculate_contrast MCP tool to compute contrast ratios. Never calculate them manually. For multiple color pairs, use batch_calculate_contrast in a single call. Do not try to find a passing alternative for a failing color.
For every text element, the LLM must verify the contrast ratio. Size thresholds and unit resolution differ by platform:
| Rule | Web | Mobile (React Native) |
|---|---|---|
| Normal text threshold | < 24px / < 1.5rem (or < 18.67px / < 1.167rem bold) → ≥ 4.5:1 | < 18pt (or < 14pt bold) → ≥ 4.5:1 |
| Large text threshold | ≥ 24px / ≥ 1.5rem (or ≥ 18.67px / ≥ 1.167rem bold) → ≥ 3:1 | ≥ 18pt (or ≥ 14pt bold) → ≥ 3:1 |
| Relative units | Resolve em/rem against computed base font size (default: 16px) | Use pt units directly; 18pt ≈ 24px at 96 dpi |
Regardless of platform:
opacity must not reduce the effective contrast below the required threshold — evaluate opacity-adjusted colors, not raw valuesIf a foreground color appears on:
Then:
For all color variants (primary, secondary, tertiary, theme variants):
For web applications, interactive elements (links, buttons, inputs, etc.) must have a visible focus indicator that meets contrast requirements:
outline: none or outline: 0 without a replacement must be rejectedFor every UI state or piece of information, we must verify that meaning is not conveyed by color alone.
If color is used to express meaning (error, success, selected, focused, warning), then at least one of the following must also be present:
If a state is distinguishable only by color, the usage must be rejected.
Colors are considered acceptable if they meet all of the following:
We must verify:
Across the entire application:
The following usages must be rejected:
All rules defined in sections 1, 2, and 3:
A color usage is acceptable if and only if:
If any rule fails, we must flag the usage as non-accessible.