[tools] Add check_color_contrast_tool for WCAG accessibility compliance#53
Merged
mattpodwysocki merged 2 commits intomainfrom Jan 12, 2026
Merged
[tools] Add check_color_contrast_tool for WCAG accessibility compliance#53mattpodwysocki merged 2 commits intomainfrom
mattpodwysocki merged 2 commits intomainfrom
Conversation
Implements a comprehensive color contrast checker that validates color combinations against WCAG 2.1 accessibility standards. Key features: - Calculates contrast ratios using WCAG 2.1 algorithm - Supports multiple color formats (hex, rgb, rgba, named colors) - Validates against WCAG AA and AAA levels - Separate requirements for normal and large text - Provides actionable recommendations when contrast fails - Full luminance calculation with gamma correction The tool extends BaseTool for offline operation (no API calls). Uses the official WCAG 2.1 relative luminance and contrast ratio formulas to ensure accurate accessibility measurements. Color format support: - 3-digit, 6-digit, and 8-digit hex colors (#RGB, #RRGGBB, #RRGGBBAA) - RGB and RGBA functional notation - CSS named colors (black, white, red, blue, etc.) WCAG requirements: - AA: 4.5:1 (normal text), 3:1 (large text) - AAA: 7:1 (normal text), 4.5:1 (large text) Test coverage: 28 comprehensive test cases covering all features including maximum contrast, WCAG AA/AAA compliance, all color formats, error handling, default parameters, recommendations, and real-world color combinations. Documentation: Added comprehensive README documentation with parameters, color format support, WCAG requirements, return values, and example prompts. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
mattpodwysocki
added a commit
that referenced
this pull request
Jan 9, 2026
…roduction prompt Adds comprehensive style quality validation capabilities: Skill: - Created mapbox-style-quality skill document (390+ lines) - Pre-production checklist and validation best practices - Guidance on expression validation, GeoJSON validation, and accessibility - Optimization strategies and workflow recommendations - Integration patterns for Git hooks, CI/CD, and code review Prompt: - Created prepare-style-for-production prompt - Orchestrates validation workflow using 5 quality tools: * validate_expression_tool - Validate expressions in filters/paint/layout * validate_geojson_tool - Validate GeoJSON sources * check_color_contrast_tool - WCAG accessibility compliance * optimize_style_tool - Remove redundancies and optimize * compare_styles_tool - Compare versions (implicit in workflow) - Configurable WCAG level (AA/AAA) and optional optimization skip - Generates comprehensive quality report with deployment readiness assessment Testing: - 15 test cases for PrepareStyleForProductionPrompt - All 386 tests passing - Updated prompt registry tests Documentation: - Updated README with new skill listing - Added prompt documentation with usage examples - Cross-referenced skill and prompt Related PRs: - PR #50: validate_geojson_tool - PR #51: validate_expression_tool - PR #52: compare_styles_tool - PR #53: check_color_contrast_tool - PR #54: optimize_style_tool Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Valiunia
previously approved these changes
Jan 12, 2026
…styles_tool, and optimize_style_tool
Valiunia
approved these changes
Jan 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements a comprehensive color contrast checker that validates color combinations against WCAG 2.1 accessibility standards.
Key Features
Implementation Details
BaseToolfor offline operation#RGB#RRGGBB#RRGGBBAArgb(r, g, b),rgba(r, g, b, a)black,white,red,blue, etc.WCAG 2.1 Requirements
Testing
All tests passing ✅
Documentation
Added comprehensive README documentation with:
Use Cases
This tool enables:
Related PRs
Part of the offline validation tools initiative:
🤖 Generated with Claude Code