contrast-check

检查颜色对比度比率以确保符合 WCAG 无障碍标准。用于审核 UI 组件的无障碍性、验证配色方案是否满足 AA/AAA 标准或修复设计中的低对比度文本。

仓库最近推送
GitHub Stars
219
Forks
38
Issues / PRs
1

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "contrast-check":https://skillpi.com/zh/skills/deepskill-b1a06a0cc50c43c55e0247f29d85d00aa5e5638d01016f14da44651db7743f3a。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

检查颜色对比度比率以确保符合 WCAG 无障碍标准。用于审核 UI 组件的无障碍性、验证配色方案是否满足 AA/AAA 标准或修复设计中的低对比度文本。

0 下载

介绍来源: third_party · TerminalSkills · 1.0.0 参考来源

SkillPi 解读

实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: contrast-check
description: >-
  Check color contrast ratios for WCAG accessibility compliance. Use when: auditing UI
  components for accessibility, validating color schemes meet AA/AAA standards, fixing
  low-contrast text in designs.
license: MIT
compatibility: "Node.js 18+"
metadata:
  author: terminal-skills
  version: "1.0.0"
  category: design
  tags: [accessibility, wcag, contrast, color, design]

Contrast Check

Overview

Check color pairs against WCAG 2.1 contrast requirements. Pass in hex colors and get contrast ratios with AA/AAA pass/fail results for both normal and large text.

  • Checking if a text color is readable against a background color
  • Auditing an entire color palette for accessibility compliance
  • Verifying colors extracted from a design meet WCAG standards

Instructions

  1. Takes a list of hex colors as arguments
  2. Computes the contrast ratio for every foreground/background pair
  3. Tests each pair against WCAG 2.1 AA and AAA thresholds for normal and large text

WCAG thresholds:

  • AA normal text — ratio >= 4.5:1
  • AA large text — ratio >= 3:1
  • AAA normal text — ratio >= 7:1
  • AAA large text — ratio >= 4.5:1

Run the script with two or more hex colors (with or without # prefix):

bash <skill-path>/scripts/contrast-check.sh <color1> <color2> [color3] [color4] ...

The script outputs JSON with contrast ratios and pass/fail results:

{
  "pairs": [
    {
      "foreground": "#1a1a2e",
      "background": "#ffffff",
      "ratio": 16.57,
      "aa": { "normal": true, "large": true },
      "aaa": { "normal": true, "large": true }
    }
  ],
  "summary": {
    "totalPairs": 2,
    "passAA": 1,
    "passAAA": 1,
    "failAA": 1
  }
}

After checking, present a table to the user:

Contrast Check Results:

  #1a1a2e on #ffffff — 16.57:1 — AA: Pass — AAA: Pass
  #e94560 on #ffffff —  3.94:1 — AA: Fail (normal) / Pass (large) — AAA: Fail

Summary: 1/2 pairs pass AA for normal text, 1/2 pass AAA.

Flag any failing pairs and suggest fixes (darken/lighten the color to reach the threshold).

Examples

Example 1: Check a dark theme header against white text

bash <skill-path>/scripts/contrast-check.sh "#1a1a2e" "#ffffff"

Output:

{
  "pairs": [
    {
      "foreground": "#1a1a2e",
      "background": "#ffffff",
      "ratio": 16.57,
      "aa": { "normal": true, "large": true },
      "aaa": { "normal": true, "large": true }
    }
  ],
  "summary": { "totalPairs": 1, "passAA": 1, "passAAA": 1, "failAA": 0 }
}

Example 2: Audit a full brand palette

bash <skill-path>/scripts/contrast-check.sh "#1a1a2e" "#e94560" "#ffffff" "#3d83f7" "#bdbdbd"

The script checks all foreground/background combinations and reports which pairs fail AA or AAA. For example, #e94560 on #ffffff yields a ratio of 3.94:1 which fails AA for normal text but passes for large text.

Guidelines

  • Colors must be valid hex values (3 or 6 digits, with or without #).
  • Pair with the image-analysis skill to extract colors from a design first, then pipe the hex values into this skill to audit accessibility.
  • When a pair fails, suggest darkening or lightening one of the colors to meet the target ratio.

当前收录版本

1.0.0

核对来源版本 ↗

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值82/100

亮点

  • 提供 WCAG 无障碍颜色对比度检查,解决设计师和开发者的实际痛点
  • 支持批量颜色对检查,适用于品牌配色审核等高频场景
触发精准88/100

亮点

  • 触发场景描述清晰,涵盖 UI 审核、配色验证、修复低对比度等典型用例
结构规范92/100

亮点

  • 文档结构完整,包含完整的使用说明、示例和集成指南
  • frontmatter 信息齐全,示例输出格式规范
执行可靠65/100

待提升项

  • 依赖脚本文件缺失 原报告严重程度:重大

    Skill 依赖 scripts/contrast-check.sh 脚本执行,但该文件未包含在传入内容中

    改进建议:请补充提供 contrast-check.sh 脚本文件,确保其包含完整的颜色对比度计算逻辑和错误处理

亮点

  • 参数说明清晰,支持多种 hex 颜色格式输入
  • 输出格式标准化,便于后续处理和展示
证据可验 (前四项均值)82/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。