Compute a contrast ratio yourself before you trust the chat

Black on white must be 21. #777777 on white is about 4.478 — under 4.5 — so a one-decimal “4.5” is not a pass.

Published 2026-11-24 · Translation: VI

In short

  • Use the WCAG 2.2 contrast definition (Understanding SC 1.4.3): relative luminance, cutoff 0.04045, then (L1 + 0.05) / (L2 + 0.05).
  • Write four known results before you read the chat: black/white = 21, white/black = 21, #767676 on white ≈ 4.542 (meets 4.5), #777777 on white ≈ 4.478 (under 4.5).
  • Keep the chat’s pass/fail only when your function reprints those four lines. Compare the full number — one decimal place is too coarse.

Example (made up): “Pay” at 16px regular (weight 400) on #FFFFFF. A chat may say #777777 is “about 4.5:1” and passes. Your function decides.

Same habit as a unit conversion or a spreadsheet formula.

Black/white → 21; swap → still 21; #767676 → ~4.542. Then score the Pay label.

A flat formula (skip the power) still prints 21 for black/white. #767676 is the check that catches it.

Where 21 comes from

Contrast ratio = (lighter + 0.05) / (darker + 0.05). Relative luminance for sRGB: convert each 8-bit channel (/255), then if ≤ 0.04045 divide by 12.92, else raise ((c + 0.055) / 1.055) to 2.4. Then L = 0.2126R + 0.7152G + 0.0722B.

Black L = 0, white L = 1 → (1.05) / (0.05) = 21. Order does not matter after both luminances exist.

The gray that needs the power

#767676 (channel 118) on white → Node printed 4.542224959605253 (meets 4.5).
A flat formula without the power printed ~2.05 — under both 4.5 and 3.

#777777 (channel 119) on white → 4.478089453577214 — under 4.5.
toFixed(1) prints "4.5" for both — that is why one decimal lies.

#767676 meets 4.5; #777777 does not. Both one-decimal readouts say 4.5.

Measure specified hex on #FFFFFF. Smoothed screenshots are a different reading.

16px regular text is under “large text,” so the bar is 4.5:1 (technique G18), not 3:1.

Pair Print How it sits
#000000 / #FFFFFF 21 meets 4.5
#FFFFFF / #000000 21 meets 4.5
#767676 / #FFFFFF 4.542224959605253 meets 4.5
#777777 / #FFFFFF 4.478089453577214 under 4.5
#949494 / #FFFFFF 3.0334698257384747 meets 3, under 4.5

Ask the chat, then run the function

WCAG 2.2 relative luminance, cutoff 0.04045, then (L1 + 0.05) / (L2 + 0.05).
Known results, written before your answer:
#000000 on #FFFFFF = 21
#FFFFFF on #000000 = 21
#767676 on #FFFFFF = 4.542224959605253, which meets 4.5
#777777 on #FFFFFF = 4.478089453577214, which is under 4.5
The label is 16px, not bold, on #FFFFFF. Compare the full number. One decimal place is too coarse.
Give one hex for the label. I will run this function on the four pairs and on your hex.

Keep the reply when the four known prints match and the suggested hex meets the bar you asked about.

Four known pairs above the function. Match all four → keep. Any other print → discard.

Matching 21 alone is not enough — #767676 catches a missing power step.

Watch-outs

  • Old luminance weights (0.299 / 0.587 / 0.114) can clear a 3:1 bar on blue/black that WCAG misses (2.444).
  • Inactive controls and logos have different exemptions on the Understanding page — this checklist is an active label.
  • Name both colors. One hex alone has no ratio.
  • Evaluate in sRGB unless another space is in use. Re-run on your machine.

Share

X Facebook LinkedIn
Educational content only. Rankings reflect stated criteria at the update date—not investment advice or permanent performance guarantees.