Getting Started
Install and start using ccr for WCAG color contrast checking.
Installation
Run directly with npx (no install required):
npx @siluat/color-contrast-cli '#ffffff' '#000000'Or install globally:
npm install -g @siluat/color-contrast-cliccr '#ffffff' '#000000'Quick Example
ccr '#333333' '#ffffff'
# Ratio 12.63:1
# Normal AAA ✅
# Large AAA ✅Use --suggest to get an accessible alternative when contrast fails:
ccr '#999999' '#ffffff' --suggest --level AAUse --batch to audit multiple pairs from a file:
ccr --batch < palette.txtLibrary
The computation engine is available as a standalone JavaScript/TypeScript library:
npm install @siluat/color-contrastimport { contrastRatio, checkContrast } from '@siluat/color-contrast';
const ratio = contrastRatio('#ffffff', '#000000');
// 21
const result = checkContrast('#333333', '#ffffff');
// { ratio: 12.63, normalText: 'AAA', largeText: 'AAA' }See the Library API reference for full documentation.