MCP HubMCP Hub
スキル一覧に戻る

wcag-contrast-checker

lsst-sqre
更新日 Today
57 閲覧
2
1
2
GitHubで表示
デザインgeneral

について

このスキルは、アクセシビリティ準拠を確保するために、2色間のWCAGカラーコントラスト比をチェックします。CSSのあらゆるカラーフォーマット(16進数、RGB、HSL、色名)を受け入れ、コントラスト比と通常テキスト・大テキストに対するAA/AAA準拠レベルを返します。ウェブアクセシビリティ基準を満たすカラー組み合わせを検証する必要がある場合にご利用ください。

クイックインストール

Claude Code

推奨
プラグインコマンド推奨
/plugin add https://github.com/lsst-sqre/squareone
Git クローン代替
git clone https://github.com/lsst-sqre/squareone.git ~/.claude/skills/wcag-contrast-checker

このコマンドをClaude Codeにコピー&ペーストしてスキルをインストールします

ドキュメント

WCAG Contrast Checker

This skill checks the color contrast ratio between two colors to ensure they meet WCAG accessibility standards. It accepts colors in various CSS formats (hex, rgb, rgba, hsl, hsla, named colors) and returns the contrast ratio along with compliance levels for normal and large text.

Supported Color Formats

  • Hex: #fff, #ffffff, #333
  • RGB: rgb(255, 0, 0), rgb(51, 51, 51)
  • RGBA: rgba(255, 0, 0, 0.5) (alpha is ignored for contrast calculation)
  • HSL: hsl(120, 100%, 50%)
  • HSLA: hsla(120, 100%, 50%, 0.8) (alpha is ignored)
  • Named colors: white, black, red, blue, lightgray, etc.

WCAG Standards

Level AA (Minimum)

  • Normal text (< 18pt or < 14pt bold): Requires 4.5:1 contrast ratio
  • Large text (≥ 18pt or ≥ 14pt bold): Requires 3:1 contrast ratio

Level AAA (Enhanced)

  • Normal text (< 18pt or < 14pt bold): Requires 7:1 contrast ratio
  • Large text (≥ 18pt or ≥ 14pt bold): Requires 4.5:1 contrast ratio

Dependencies

  • Python 3.8+
  • pip install colour>=0.1.5 (for CSS color parsing and manipulation)
  • uv (for running the Python script)

Dependencies are automatically handled by uv run with inline script metadata.

Examples

Check contrast between black text and white background:

uv run --script check_contrast.py --foreground "#000" --background "#fff"

Check contrast using named colors:

uv run --script check_contrast.py --foreground "darkblue" --background "lightgray"

Check contrast using rgb format:

uv run --script check_contrast.py --foreground "rgb(51, 51, 51)" --background "rgb(255, 255, 255)"

Tips

  • The tool accepts any valid CSS color format including hex, rgb, rgba, hsl, hsla, and named colors
  • WCAG AA requires 4.5:1 for normal text and 3:1 for large text
  • WCAG AAA requires 7:1 for normal text and 4.5:1 for large text
  • Large text is defined as 18pt+ or 14pt+ bold

Troubleshooting

Invalid Color Format

If you get a color parsing error, ensure your color is in a valid CSS format:

# ✗ Wrong
--foreground "333"

# ✓ Correct
--foreground "#333"

Technical Details

The script implements the WCAG 2.0 contrast ratio formula:

  1. Relative Luminance Calculation: Converts sRGB values to linear RGB and applies the luminance formula
  2. Contrast Ratio: (L1 + 0.05) / (L2 + 0.05) where L1 is the lighter color
  3. Compliance Check: Compares ratio against WCAG thresholds

GitHub リポジトリ

lsst-sqre/squareone
パス: .claude/skills/wcag-contrast-checker
nextjsrubin-science-platform

関連スキル

algorithmic-art

メタ

This Claude Skill creates original algorithmic art using p5.js with seeded randomness and interactive parameters. It generates .md files for algorithmic philosophies, plus .html and .js files for interactive generative art implementations. Use it when developers need to create flow fields, particle systems, or other computational art while avoiding copyright issues.

スキルを見る

subagent-driven-development

開発

This skill executes implementation plans by dispatching a fresh subagent for each independent task, with code review between tasks. It enables fast iteration while maintaining quality gates through this review process. Use it when working on mostly independent tasks within the same session to ensure continuous progress with built-in quality checks.

スキルを見る

executing-plans

デザイン

Use the executing-plans skill when you have a complete implementation plan to execute in controlled batches with review checkpoints. It loads and critically reviews the plan, then executes tasks in small batches (default 3 tasks) while reporting progress between each batch for architect review. This ensures systematic implementation with built-in quality control checkpoints.

スキルを見る

cost-optimization

その他

This Claude Skill helps developers optimize cloud costs through resource rightsizing, tagging strategies, and spending analysis. It provides a framework for reducing cloud expenses and implementing cost governance across AWS, Azure, and GCP. Use it when you need to analyze infrastructure costs, right-size resources, or meet budget constraints.

スキルを見る