Source: https://guthlabs.ai/docs/instruments/wcag-contrast-ratio-checker/mechanism/

instrument mechanism / verified-clean

# WCAG Contrast Ratio Checker mechanism

The inspectable method record for WCAG Contrast Ratio Checker, kept separate from implementation and qualification.

Status: **VERIFIED_CLEAN**Lifecycle: **verified-clean**

## Model scope

The honest label correctly distinguishes the WCAG 2.x relative-luminance model from WCAG 3 APCA. Verdict is NEEDS_REVIEW because the exact luminance implementation, luminance ordering, AAA large-text threshold, input color encoding, and large-text definition are not fully specified.

- The contrast formula is correct only when L1 is the greater of the two relative luminances and L2 is the lesser; the specification does not explicitly require max/min ordering.

- The relative-luminance formula is underspecified: it should explicitly define sRGB channel normalization, the 0.04045 linearization breakpoint, the 12.92 divisor, the 2.4 exponent, and the coefficients 0.2126, 0.7152, and 0.0722.

- The listed threshold constants are incomplete and ambiguous: WCAG AAA is 7:1 for normal text but 4.5:1 for large text, while the spec lists only 7:1 for AAA despite promising normal and large text results.

- The specification does not define the WCAG large-text classification needed to select the large-text thresholds: at least 18 point regular or 14 point bold, approximately 24px regular or 18.67px bold.

## Units and conventions

- Colors are standard sRGB colors, supplied as 8-bit channels or hexadecimal values and normalized from 0-255 to 0-1 before linearization.

- For each sRGB channel c, use c/12.92 when c<=0.04045; otherwise use ((c+0.055)/1.055)^2.4.

- Relative luminance is L=0.2126R+0.7152G+0.0722B, with the WCAG sRGB/D65 coefficients.

- The reported contrast ratio is unitless and uses L1=max(Lforeground,Lbackground) and L2=min(Lforeground,Lbackground).

- Pass thresholds are inclusive: AA normal >=4.5, AA large >=3, AAA normal >=7, and AAA large >=4.5.

## Inspectable vector

One of 4 source-bound review vectors:

````
{
  "inputs": {
    "foreground": "#000000",
    "background": "#FFFFFF"
  },
  "expected_outputs": {
    "contrast_ratio": 21,
    "AA_normal": true,
    "AA_large": true,
    "AAA_normal": true,
    "AAA_large": true
  },
  "working": "Normalize black=(0,0,0), white=(1,1,1). Black linear channels=(0,0,0), so Lblack=0. White linear channels=(1,1,1), so Lwhite=0.2126+0.7152+0.0722=1. L1=1 and L2=0. Contrast=(1+0.05)/(0+0.05)=1.05/0.05=21.00. Compare: 21>=4.5, 21>=3, 21>=7, and 21>=4.5, so every result passes."
}
````

## Failure boundary

**BREAK_CLAIMED** · SELF_FLAGGED

An out-of-range sRGB input can make relative luminance equal -0.05 and force the contrast denominator to zero. The checker must validate channel ranges and reject such input rather than return Infinity, NaN, or a misleading pass/fail result.

## Other records

[01**Overview**](<https://guthlabs.ai/docs/instruments/wcag-contrast-ratio-checker/>)[03**Implementation**](<https://guthlabs.ai/docs/instruments/wcag-contrast-ratio-checker/implementation/>)[04**Qualification**](<https://guthlabs.ai/docs/instruments/wcag-contrast-ratio-checker/qualification/>)

## Sources and evidence

These pointers bind the page to evidence. They do not grant authority or collapse verification into deployment.

- `VERIFIED_LEDGER.json`

- `evidence-tranche5/tranche5-results.json`

- `BOUNDARY_HAZARD_CATALOG.json`
