wcag-contrast-checker

Compute WCAG contrast ratios and AA/AAA compliance for CSS colors.

2|1|Updated Jan 7, 2021
One-click install
npx skills add https://github.com/lsst-sqre/squareone --skill wcag-contrast-checker
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wcag-contrast-checker
Source: https://github.com/lsst-sqre/squareone/tree/main/.claude/skills/wcag-contrast-checker
Command: npx skills add https://github.com/lsst-sqre/squareone --skill wcag-contrast-checker

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires colour>=0.1.5, uv, and includes scripts (resource) components.

What problem does it solve?

Ensuring sufficient color contrast is crucial for web accessibility (WCAG compliance) but can be a manual and error-prone process. This skill automates the calculation and validation of contrast ratios, helping designers and developers meet accessibility standards effortlessly.

Core Features & Use Cases

  • WCAG Compliance Check: Calculates contrast ratios between any two CSS colors and reports compliance against WCAG AA and AAA levels for normal and large text.
  • Flexible Color Input: Accepts various CSS color formats including hex, RGB, HSL, and named colors.
  • Automated Accessibility Audit: Quickly verify if your UI color combinations are accessible, preventing issues for users with visual impairments.
  • Use Case: Before finalizing a new UI theme, use this skill to check if the text color on a button background meets WCAG AA standards, ensuring readability for all users.

Quick Start

Check the WCAG contrast ratio between a dark blue foreground and a light gray background. uv run --script check_contrast.py --foreground "darkblue" --background "lightgray"

Frequently Asked Questions about wcag-contrast-checker

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I check if my color combinations meet WCAG accessibility standards?

WCAG contrast checking calculates the luminance ratio between two colors to ensure legibility. Use this skill by providing foreground and background colors in CSS formats (hex, RGB, HSL, or named colors), and it returns the contrast ratio plus AA/AAA compliance status for normal and large text.

What CSS color formats does a contrast checker accept?

A contrast checker accepts multiple CSS color formats including hexadecimal (#FFF), RGB/RGBA, HSL/HSLA, and named colors (darkblue, lightgray). This flexibility lets you validate colors directly from your design files or stylesheets without conversion.

How do I audit my UI color palette for accessibility compliance?

Run contrast ratio calculations on each text-and-background color pair in your palette. The skill compares each ratio against WCAG AA and AAA thresholds for normal and large text, letting you identify combinations that fail accessibility standards before deployment.

Can I use contrast checking for both normal and large text accessibility?

Yes. WCAG defines separate contrast requirements for normal text and large text (18pt or 14pt bold). This skill reports compliance for both sizes, so you can verify that your design meets the appropriate threshold for each text scale.

What's the difference between WCAG AA and AAA contrast levels?

WCAG AA requires a 4.5:1 contrast ratio for normal text; AAA requires 7:1. Large text has lower thresholds. This skill reports both levels so you can choose the accessibility standard your design needs to meet.

Do I need to manually calculate contrast ratios for color audits?

No. Manual calculation is error-prone and slow. This skill automates ratio computation and compliance checks, letting designers and developers verify accessibility in seconds rather than performing tedious calculations by hand.