color-contrast
Skill50 starsChanged 11 months agoMITView on GitHub
Validates WCAG 2.1 contrast ratios and generates accessible color pairings. Use when checking accessibility compliance, fixing contrast issues, or selecting text/background combinations for AA or AAA levels.
4 other projects use a version of this.
Adopted by
Most recently taken up by
- mgifford/accessibility-skillstheir own version, first seen Nov 12, 2026
- jholhewres/devclaw-skillstheir own version, first seen Oct 9, 2026
- miovrag/claude-skillstheir own version, first seen Jun 12, 2026
- siluat/skillstheir own version, first seen Mar 29, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- mgifford/accessibility-skills★ 61same name
- jholhewres/devclaw-skills★ 4same name
- miovrag/claude-skills★ 1same name
- siluat/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository29 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- aria-patternsSkill
- focus-statesSkill
- component-docsSkill
- token-docsSkill
- angularSkill
- reactSkill
- svelteSkill
- vueSkill
- getting-startedSkill
- animation-principlesSkill
- compound-componentsSkill
- dark-modeSkill
- icon-systemSkill
- layout-primitivesSkill
- breakpointsSkill
- color-scaleSkill
- design-tokens-structureSkill
- motion-scaleSkill
- radius-scaleSkill
- responsive-typographySkill
- shadow-scaleSkill
- spacing-scaleSkill
- type-scaleSkill
- z-index-scaleSkill
- figmaSkill
- framerSkill
- storybookSkill
- style-dictionarySkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 3 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 30
Get colors: Ask for foreground and background colors (hex, rgb, oklch, hsl)
- Distinctive: line 34
Batch mode: If given a palette, check all combinations
- Distinctive: line 142
When using with the color-scale skill:
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Color Contrast Checker
Overview
Validate and generate accessible color combinations that meet WCAG 2.1 contrast requirements. Check existing palettes or find compliant alternatives for any color pair.
When to Use
- Validating a color palette for accessibility
- Finding accessible text colors for a background
- Checking if brand colors meet WCAG standards
- Generating accessible color pairings from tokens
Quick Reference: WCAG Requirements
| Level | Normal Text | Large Text | UI Components |
| AA | 4.5:1 | 3:1 | 3:1 |
| AAA | 7:1 | 4.5:1 | 4.5:1 |
Large text: 18pt (24px) regular or 14pt (18.5px) bold
The Process
- Get colors: Ask for foreground and background colors (hex, rgb, oklch, hsl)
- Calculate ratio: Compute relative luminance and contrast ratio
- Report compliance: Show AA/AAA pass/fail for text sizes
- If failing: Suggest closest compliant alternatives
- Batch mode: If given a palette, check all combinations
Contrast Ratio Scale
| Ratio | Rating | Suitable For |
| 21:1 | Maximum | Black on white |
| 7:1+ | Excellent | AAA all text |
| 4.5:1+ | Good | AA normal text, AAA large |
| 3:1+ | Minimum | AA large text, UI components |
| < 3:1 | Failing | Decorative only |
Output Formats
Single Pair Check:
Contrast Check: #1a1a1a on #ffffff
Ratio: 16.1:1
✓ AA Normal Text (4.5:1)
✓ AA Large Text (3:1)
✓ AAA Normal Text (7:1)
✓ AAA Large Text (4.5:1)
✓ UI Components (3:1)
Verdict: Passes all WCAG 2.1 criteriaFailing Pair with Suggestions:
Contrast Check: #6b7280 on #ffffff
Ratio: 4.0:1
✓ AA Large Text (3:1)
✗ AA Normal Text (4.5:1) - needs 4.5:1
✗ AAA Normal Text (7:1)
✓ UI Components (3:1)
Suggested fixes:
- Darken foreground to #5b6370 for AA (4.5:1)
- Darken foreground to #3d4351 for AAA (7:1)Palette Matrix:
Color Contrast Matrix (AA Normal Text = 4.5:1)
white gray-100 gray-900 primary
white - 1.1 16.1 5.2
gray-100 1.1 - 14.5 4.7
gray-900 16.1 14.5 - 3.1
primary 5.2 4.7 3.1 -
Legend: ✓ = 4.5:1+ | ⚠ = 3:1-4.5:1 | ✗ = <3:1CSS with Accessible Pairs:
:root {
/* Accessible text on light backgrounds */
--text-on-light: #1f2937; /* 14.5:1 on white */
--text-muted-on-light: #4b5563; /* 7.2:1 on white */
/* Accessible text on dark backgrounds */
--text-on-dark: #f9fafb; /* 18.1:1 on gray-900 */
--text-muted-on-dark: #d1d5db; /* 11.3:1 on gray-900 */
/* Accessible text on brand color */
--text-on-primary: #ffffff; /* 5.2:1 on primary-500 */
}Algorithm
Relative Luminance (L):
For each RGB channel (0-255):
1. Normalize: value / 255
2. If ≤ 0.03928: channel / 12.92
3. Else: ((channel + 0.055) / 1.055) ^ 2.4
L = 0.2126 * R + 0.7152 * G + 0.0722 * BContrast Ratio:
ratio = (L1 + 0.05) / (L2 + 0.05)
where L1 is lighter, L2 is darkerCommon Patterns
Accessible grays on white:
| Gray | Hex | Ratio | Use |
| 600 | #4b5563 | 7.2:1 | Body text (AAA) |
| 500 | #6b7280 | 4.6:1 | Body text (AA) |
| 400 | #9ca3af | 2.9:1 | Large text only |
Accessible brand colors:
- Light backgrounds: Darken brand to 500-700 range
- Dark backgrounds: Lighten brand to 300-400 range
- On brand: Use white (dark brands) or gray-900 (light brands)
Integration with Color Scale
When using with the color-scale skill:
1. Generate palette with color-scale
2. Run contrast check on key combinations:
- Text colors (900, 800) on backgrounds (50, 100)
- Background (500) with white/dark text
- Adjacent scale steps for borders
3. Adjust chroma/lightness if needed
4. Document accessible pairingsTesting Checklist
- Primary text on all background colors
- Secondary/muted text on backgrounds
- Interactive elements (buttons, links)
- Focus indicators against backgrounds
- Error, warning, success states
- Disabled states (3:1 minimum for discernible)
- Placeholder text in inputs
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

