Abstract color difference methodology workspace with paired color swatches, Lab and OKLab-style coordinate panels, distance markers, comparison bands, and layered review cards.

Short answer

Hue Codex calculates Delta E 76 as Euclidean distance in CIE Lab and OKLab distance as Euclidean distance in OKLab scaled for readability. These scores are useful signals, not universal human perception guarantees.

  • Delta E 76 is simple, symmetric, and easy to explain, but less perceptually uniform than newer tolerance formulas.
  • OKLab distance is reported as a modern perceptual-style companion signal.
  • Contrast ratio and color difference answer different questions and should not be substituted for each other.
  • Image extraction and color-vision simulation use Delta E style distance for closeness and risk ranking.

Standards status

These badges identify which parts of this methodology are standards-backed, draft-track, Hue Codex-specific, approximate, or dependent on browser behavior.

Standard Hue Codex heuristic Approximation
Standard Stable standard or standards-backed behavior used as authority, such as WCAG 2.2 and broadly implemented CSS Color 4 behavior.
Hue Codex heuristic Hue Codex ranking, role hints, bands, labels, or workflow guidance rather than an external standard.
Approximation Model or estimate with known limits, including CMYK, color-vision simulation, image palette extraction, or CSS duotone output.

Formulas, choices, heuristics, and limits

This separates standards-based formulas from Hue Codex implementation decisions, product heuristics, and known limitations for this methodology.

Standards-based formulas

Formula, threshold, syntax, or data behavior taken from a cited standard or standards-backed source.

  • Delta E 76 is calculated as Euclidean distance in CIE Lab.
  • CSS Color 4 Lab, OKLab, XYZ, and conversion context support the coordinate calculations.

Implementation choices

How Hue Codex chooses to parse, normalize, round, export, or sequence calculations.

  • Hue Codex normalizes both colors to sRGB HEX before converting and comparing them.
  • OKLab distance is scaled for readability so it can sit beside Delta E style bands.
  • Comparison results are reported separately from contrast because they answer different questions.

Hue Codex heuristics

Product rankings, bands, labels, suggestions, or role hints that are useful guidance but not external standards.

  • Color-difference interpretation bands are Hue Codex labels, not universal pass/fail standards.
  • Near-duplicate filtering and extracted-palette diversity ranking use distance as a product heuristic.

Known limitations

Caveats, edge cases, browser dependencies, approximations, or contexts the method does not prove.

  • Delta E 76 is simple and explainable but not uniformly perceptual in every color region.
  • A high color-difference score does not mean text is readable.
  • Viewing conditions, display calibration, materials, and adaptation can change perceived difference.

Inputs and conversion

Standard

Hue Codex normalizes both colors to sRGB HEX, converts them to Lab and OKLab, then compares component differences. The same conversion engine used by color conversion tools is used here.

The comparison is symmetric: color A compared to color B produces the same distance as color B compared to color A.

Delta E 76 and OKLab distance

Standard Approximation

Delta E 76 is the Euclidean distance between Lab coordinates: the square root of the sum of squared differences in L, a, and b.

OKLab distance uses the same Euclidean idea on OKLab components and scales the result by 100 to make values easier to read next to Delta E bands.

Interpretation bands

Hue Codex heuristic
Hue Codex color-difference bands.
Delta E 76 range Label
0 to 1 Practically identical
Greater than 1 to 2.3 Tiny visible shift
Greater than 2.3 to 10 Close visible variant
Greater than 10 to 20 Clearly different
Greater than 20 to 35 Distinct palette color
Greater than 35 Strongly separated

Limits

Approximation Browser-dependent
  • Delta E 76 does not model every perceptual condition equally well.
  • A high color-difference score does not mean text is readable.
  • A low score can still matter if the colors have different semantic roles or are used in small UI details.
  • Display calibration, viewing conditions, materials, and adaptation can change perceived difference.

Validation checks

Hue Codex heuristic
Color-difference QA checks.
Check Expected behavior
Same HEX compared with itself Zero distance
A compared with B and B compared with A Same distance
Near duplicate extracted swatches Ranked as close before more distinct palette colors
Contrast compared with Delta E Reported separately because they measure different things

Color-difference equations

Standard Approximation Hue Codex heuristic

The formulas are standards-based or standards-derived color-space math. The interpretation bands remain Hue Codex heuristics.

Delta E 76 and OKLab distance
delta_e_76(hex_a, hex_b):
  lab_a = rgb_to_lab(hex_to_rgb(hex_a))
  lab_b = rgb_to_lab(hex_to_rgb(hex_b))
  dL = lab_a.L - lab_b.L
  da = lab_a.a - lab_b.a
  db = lab_a.b - lab_b.b
  return sqrt(dL*dL + da*da + db*db)

oklab_distance_x100(hex_a, hex_b):
  ok_a = rgb_to_oklab(hex_to_rgb(hex_a))
  ok_b = rgb_to_oklab(hex_to_rgb(hex_b))
  dL = ok_a.L - ok_b.L
  da = ok_a.a - ok_b.a
  db = ok_a.b - ok_b.b
  return sqrt(dL*dL + da*da + db*db) * 100

comparison rule:
  report Delta E, OKLab distance, hue shift, lightness shift, and WCAG contrast separately

Reproducible test vectors

Standard Approximation Hue Codex heuristic

These vectors validate Delta E 76, the scaled OKLab distance, and the separation between color difference and WCAG contrast.

Color-difference vectors.
Input Expected output Notes
#000000 vs #000000 Delta E 76 = 0; OKLab distance x100 = 0; contrast = 1 Identical colors
#000000 vs #FFFFFF Delta E 76 = 100; OKLab distance x100 = 100.00000000000003; contrast = 21 Floating point output may display OKLab distance as 100 after rounding
#4169E1 vs #426AE2 Delta E 76 = 0.40135924369994574; OKLab distance x100 = 0.31669742682101304; contrast = 1.013575785094293 Near-duplicate vector
#FF0000 vs #00FF00 Delta E 76 = 163.9260164011685; OKLab distance x100 = 51.98129015519161; contrast = 2.9139375476009137 Large color difference does not imply passing text contrast

Sources and standards

These references anchor the public standards and formats used by Hue Codex. Status badges distinguish stable standards, drafts, Hue Codex heuristics, approximations, and browser-dependent behavior.

Tools using this methodology

These Hue Codex tools link to this methodology because they depend on the formulas, assumptions, limits, or data policy described here.