ccr
WCAG color contrast ratio checker for the command line.
A command-line tool for checking WCAG color contrast ratios. Install nothing — just run:
npx @siluat/color-contrast-cli '#708090' '#ffffff'Contrast ratio: 3.94:1
Normal text: Fail ✗
Large text: AA ✓Why ccr?
CI/CD Ready
Gate your pipeline with --level AA exit codes. Pipe --json output to other tools for automated reporting.
Color Suggestion
When contrast fails, --suggest finds the closest accessible color. Adjusts only OkLCH lightness to preserve the original hue and saturation.
Batch Audit
Audit an entire design system palette at once with --batch. Supports comments, blank lines, and mixed color formats.
10 Color Formats
#hex, rgb(), hsl(), hwb(), lab(), lch(), oklab(), oklch(), and named colors — broad CSS Color Level 4 coverage.
Quick Start
npm install -g @siluat/color-contrast-cliccr '#333' '#fff'ccr '#999' '#fff' --suggest --level AAccr --batch < palette.txtRead the Getting Started guide for more details, or jump to the CLI Reference for the full option list.
Library
The computation engine is also available as a standalone JavaScript/TypeScript library — @siluat/color-contrast — for programmatic use.