Skip to main content
Analyzes color contrast on web pages or raw HTML to verify compliance with WCAG contrast requirements. Provides detailed contrast ratios, identifies failing elements, and suggests color fixes that meet accessibility standards.

Best For

Specific color contrast analysis
WCAG 2.1 or APCA algorithm comparison
Text size and weight considerations
Getting suggested color fixes with CSS code

Parameters

url
string
URL of the page to analyze
Either url or html is required, but not both.
html
string
Raw HTML content to analyze (alternative to URL)Useful for analyzing color schemes in components or templates.
options
object
Configuration options for the analysis

Response

success
boolean
required
Whether the analysis completed successfully
target
string
required
The analyzed URL or "[html content]"
wcagLevel
string
required
WCAG level used for analysis ("AA" or "AAA")
issueCount
number
required
Total number of contrast issues found
issues
array
required
List of contrast issues
summary
object
required
Aggregated statistics
duration
number
Analysis duration in milliseconds

Contrast Requirements

WCAG 2.1 (Standard)

LevelNormal TextLarge TextNon-text
AA4.5:13:13:1
AAA7:14.5:1-
Large text = 18pt+ (24px) or 14pt+ bold (18.66px)

APCA (WCAG 3.0 Draft)

Element TypeRequired Lightness (Lc)
Body text75Lc
Large text60Lc
Non-text45Lc
APCA is experimental and part of the WCAG 3.0 draft. Use WCAG 2.1 for legal/regulatory compliance.

Examples

Check the color contrast of https://example.com

Response Example

{
  "success": true,
  "target": "https://example.com",
  "wcagLevel": "AA",
  "issueCount": 3,
  "issues": [
    {
      "id": "contrast-0",
      "ruleId": "color-contrast",
      "tool": "contrast-analyzer",
      "severity": "serious",
      "wcag": {
        "criterion": "1.4.3",
        "level": "AA",
        "principle": "perceivable",
        "version": "2.1",
        "title": "Contrast (Minimum)"
      },
      "location": {
        "selector": "p.subtitle",
        "snippet": "<p class=\"subtitle\">Light gray text on white</p>"
      },
      "message": "Contrast ratio 2.5:1 does not meet AA requirements (4.5:1 required for normal text)",
      "humanContext": "Users with low vision or color blindness may have difficulty reading this text. The current contrast of 2.5:1 is below the AA threshold of 4.5:1.",
      "suggestedActions": [
        "Increase contrast ratio to at least 4.5:1",
        "Consider using #767676 as the text color"
      ],
      "affectedUsers": ["low-vision", "color-blind"],
      "contrastData": {
        "foreground": "rgb(180, 180, 180)",
        "background": "rgb(255, 255, 255)",
        "currentRatio": 2.5,
        "requiredRatio": 4.5,
        "isLargeText": false,
        "fontSize": 16,
        "fontWeight": 400,
        "suggestedFix": {
          "foreground": "#767676",
          "background": "#ffffff",
          "newRatio": 4.54
        }
      }
    }
  ],
  "summary": {
    "total": 25,
    "passing": 22,
    "failing": 3,
    "byTextSize": {
      "normalText": { "passing": 18, "failing": 3 },
      "largeText": { "passing": 4, "failing": 0 }
    }
  },
  "duration": 1234
}

Use Cases

Design System Validation

{
  "url": "https://design-system.myapp.com/colors",
  "options": {
    "wcagLevel": "AA",
    "includePassingElements": true
  }
}
Validate that your design system’s color palette meets WCAG requirements.

Compare WCAG 2.1 vs APCA

Analyze the contrast of https://example.com using both WCAG 2.1 and APCA algorithms
Run twice with different contrastAlgorithm values to compare results.

Header/Footer Specific Analysis

{
  "url": "https://example.com",
  "options": {
    "selector": "header, footer"
  }
}
Focus on specific sections with potentially problematic color schemes.

Component Color Testing

{
  "html": "<button style='background: #3498db; color: #fff;'>Submit</button>",
  "options": {
    "wcagLevel": "AAA"
  }
}
Test component color combinations before implementing in production.
Use suggestFixes: true (default) to get actionable color recommendations with exact hex values and expected contrast ratios.

WCAG 2.1 vs APCA

AspectWCAG 2.1APCA
UnitRatio (e.g., 4.5:1)Lightness contrast (Lc)
PolarityNot consideredLight-on-dark vs dark-on-light
StatusCurrent standardExperimental (WCAG 3.0 draft)
Legal/regulatoryYesNot yet
Perceptual accuracyGoodBetter
APCA is more perceptually accurate but not yet a legal standard. Use WCAG 2.1 for compliance, but consider APCA for future-proofing your design.

analyze-with-axe

Full accessibility analysis (includes basic contrast)

analyze-with-lighthouse

Lighthouse includes contrast audits

analyze-mixed

Run multiple tools together

Contrast Check Prompt

Guided contrast analysis workflow

Build docs developers (and LLMs) love