CONTRAST CHECK
颜色对比度检查,配色更无障碍。
输入前景色与背景色,按 WCAG 标准算出对比度比值,并判定普通文字、大号文字的 AA / AAA 是否达标,附实时样例。纯前端本地处理。
—
Aa 示例文字 Sample Text
对比度怎么算?
WCAG 用相对亮度算对比度:(L1+0.05)/(L2+0.05)。普通文字需 ≥4.5(AA)、≥7(AAA);大号文字(≥18pt 或 14pt 加粗)需 ≥3(AA)、≥4.5(AAA)。配色不达标会影响可读性,尤其对视力不佳者。
示例与注意事项Example & notes
一个例子A worked example
把正文色 #8B98AD 与背景 #080D1D 放进去,得到对比度约 6.1:1,满足 WCAG AA 的正文要求。Feed in text #8B98AD on background #080D1D: the ratio is about 6.1:1, which passes WCAG AA for body text.
注意事项Things to watch
- AA 正文要求 4.5:1,大字号可放宽到 3:1;AAA 要求 7:1。AA asks 4.5:1 for body text (3:1 for large text); AAA asks 7:1.
- 两种颜色越接近,比值越接近 1:1;纯黑配纯白是理论最大值 21:1。The closer the two colours, the closer the ratio is to 1:1 — black on white is the theoretical maximum of 21:1.
- 比值不是越高越好:深色主题下超过 15:1 的全白文字反而刺眼,可适当降低亮度。Higher is not always better: pure white on dark can glare above 15:1, so tune the lightness down.
相关问答More Q&A
为什么黑白比值正好是 21:1?Why is black-on-white exactly 21:1?
这是 WCAG 对比度公式推导出的理论上限:(1.05) / (0.05) = 21。It is the theoretical ceiling of the WCAG formula: (1.05) / (0.05) = 21.
能一次检查整套配色吗?Can I check a whole palette?
可逐组检查常用搭配;页面还提供明度扫描,直接给出达标区间与建议明度。Check pairs one by one; the page also sweeps lightness to show the passing range and a suggested value.