跳至主要内容

WCAG 2.2 网页色彩对比度检测与智能配色修正

基于 W3C WCAG 2.2 无障碍设计标准计算文本与 UI 组件对比度,智能推荐符合 AA/AAA 标准的最近合规色彩。

对比度检测工具已就绪。请输入或选择配色进行检测。
WCAG 2.2 AA / AAA

WCAG 2.2 对比度检测器

色彩设定

经典无障碍配色预设
对比度比例优秀对比度 (达到 AAA 级)
14.63:1

依据 W3C WCAG 2.2 官方算法 (L1 + 0.05) / (L2 + 0.05) 计算的相对亮度比值,区间为 1:1 至 21:1。

常规文本✓ AA
大号文本✓ AA
图形对象与 UI 组件✓ AA

WCAG 2.2 合规性检测结果

常规文本

16px / 常规体

正文段落与输入框 (小于 18pt/24px 或小于 14pt/18.66px 粗体)

AA 级要求 (>= 4.5:1)通过
AAA 级要求 (>= 7.0:1)通过

大号文本

>= 24px / 18.66px 粗体

大标题与醒目字 (达到 18pt/24px 或 14pt/18.66px 粗体)

AA 级要求 (>= 3.0:1)通过
AAA 级要求 (>= 4.5:1)通过

图形对象与 UI 组件

SC 1.4.11

表单边框、按钮轮廓与关键图标 (WCAG 2.2 SC 1.4.11)

AA 级要求 (>= 3.0:1)通过
* WCAG SC 1.4.11 仅在 AA 级定义非文本对比度(无 AAA 级标准)。

实时渲染预览

常规正文字体排版 (16px / Regular)

良好的色彩对比度是普惠包容性网页设计的基础基石。它能确保在强光照射、微弱照明或用户存在低视力与色觉障碍时,页面内容依然清晰可辨。

大号标题字体排版 (24px / Bold)

面向所有用户的清晰易读文字排版

交互式 UI 组件 (WCAG SC 1.4.11)
状态标签

智能色彩修正与推荐助手

对比度未达标?固定前景或背景色,算法将在 sRGB 色域中沿明度轴检索,以最小色彩距离(ΔE)计算出满足所选合规目标的最佳配色。

保持固定
目标合规比例

当前配色组合已满足或超过所选的目标对比度要求! (14.63:1 >= 4.5:1)

How WCAG 2.2 Color Contrast Works

Digital accessibility depends fundamentally on sufficient perceptual contrast between text, interface elements, and their background surfaces. The W3C Web Content Accessibility Guidelines (WCAG 2.2) establish clear mathematical criteria to ensure digital interfaces remain completely legible and operable for people with moderately low vision, color vision deficiencies (protanopia, deuteranopia, tritanopia), aging eyes, and under adverse ambient lighting conditions.

The W3C Relative Luminance & Contrast Formula

Contrast in WCAG is calculated using the relative luminance of colors in the standard sRGB color space. The relative luminance (L) of an sRGB color is determined by linearizing each 8-bit color channel (R, G, B) and weighting them according to human spectral eye sensitivity:

L = 0.2126 * R_linear + 0.7152 * G_linear + 0.0722 * B_linear
Where C_linear = (C / 255 <= 0.04045) ? (C / 255) / 12.92 : ((C / 255 + 0.055) / 1.055)^2.4

The contrast ratio between two colors is then defined as:

Contrast Ratio = (L1 + 0.05) / (L2 + 0.05)

Where L1 is the relative luminance of the lighter color and L2 is the relative luminance of the darker color. The addition of the 0.05 offset represents ambient flare compensation. This yields a ratio ranging from 1.0:1 (identical colors) up to 21.0:1 (pure black on pure white).

WCAG 2.2 Success Criteria & Thresholds

  • Normal Text (WCAG SC 1.4.3 & 1.4.6): Body text, form field labels, and descriptions require at least 4.5:1 for Level AA and 7.0:1 for enhanced Level AAA.
  • Large Text (WCAG SC 1.4.3 & 1.4.6): Text that is at least 18pt (24px) regular weight or 14pt (18.66px) bold requires at least 3.0:1 for Level AA and 4.5:1 for Level AAA.
  • Graphical Objects & User Interface Components (WCAG SC 1.4.11): Visual information required to identify user interface components (such as form field borders, button outlines, and active state indicators) and graphical objects (such as standalone icons and chart elements) requires at least 3.0:1. Note that the W3C specification defines non-text contrast at Level AA only, without an AAA requirement.

Smart In-Gamut Color Remediation

When a selected color pairing fails your target contrast ratio, our remediation optimizer allows you to hold either the foreground or background color fixed. The engine searches candidate colors along the sRGB lightness dimension to find the exact counterpart that satisfies the selected target ratio (3.0:1, 4.5:1, or 7.0:1) while strictly minimizing the Euclidean color distance (ΔE) to your original design.

Frequently Asked Questions

WCAG 2.2 对比度比例是如何计算的?
依据 W3C 国际标准公式 (L1 + 0.05) / (L2 + 0.05) 测定,其中 L1 为浅色在 sRGB 色域中的相对亮度,L2 为深色相对亮度。数值范围介于 1:1(完全同色)到 21:1(纯黑对纯白)之间。
WCAG AA 级与 AAA 级标准有什么区别?
Level AA 是全球无障碍法规(如 ADA、Section 508、中国信息无障碍标准)强制要求的通用基准。Level AAA 为深度弱视群体提供更严格的视觉保障(常规文本需达到 7.0:1)。
WCAG 2.2 针对非文本 UI 界面元素是否设立了 AAA 级?
没有。成功准则 1.4.11(非文本对比度)仅在 AA 级别制定了 >= 3.0:1 的硬性要求。W3C 规范并未对非文本图形设立 AAA 级标准。
智能修正算法是如何寻找推荐配色的?
算法固定您指定的基准锚点色,在 sRGB 空间中搜索满足目标对比度(3.0:1、4.5:1 或 7.0:1)的候选颜色,并通过欧几里得色差公式(ΔE)最小化与原始设计的视觉偏差。