You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[css-color-4] Discrepancy between § 19.1. ΔE2000 implementation and ISO 11664-6:2014/Sharma et al., 2005 #13322
The sample implementation in section of 19.1. ΔE2000 of CIEDE2000 has a discrepancy in the computation of the mean hue angle $\overline{h'}$ versus the equation in ISO/CIE 11664-6:2014 (I do not have the 2022 version available) which reference the paper by Sharma et al., 2005.
The offending line exists on line 103 of the code snippet:
if(Cdash1==0&&Cdash2==0){
where $\overline{h'}$ (hdash in code) is set to hsum if Cdash1andCdash2 is zero, which differs from the specification condition that $C'_1 \cdot{} C'_2 = 0$, which would be implemented in code as:
if(Cdash1*Cdash2===0){
The above condition is correctly implemented for the computation of $Δh'$ (Δh in code) as seen on line 75 of the implementation.
Mathematically, the discrepancy does not matter in the final computation of the ΔE2000 value since having either $C'_1$ or $C'_2$ be 0 means that the $ΔH$ value is 0, and the mean hue angle $\overline{h'}$ is always eventually multiplied with $ΔH$, making the discrepancy disappear in the final result.
However, the intermediate values $Δθ$, $T$, and $R_T$ do show the discrepancy and may not match testing data that expect all the intermediate values to match as well.
A specific test pair of: Reference L = 50.00, a = 0.000, b = 0.000
and Sample L = 50.00, a = 10.00, b = -114.3
can be used to show large deviations between the two specifications for the $Δθ$, $T$, and $R_T$ values (as well as $\overline{h'}$), with $Δθ = 30.000$ for ISO/CIE 11664-6:2014 and $Δθ = 1.6669$ for the sample implementation in section 19.1. ΔE2000.
I was wondering what the rationale behind the change in implementation is, as the code comments don't seem to note anything about this discrepancy.
Activity
facelessuser commentedon Jan 11, 2026
Yes, this is a mistake. The reference implementation was corrected, but it wasn't in the spec, or at least not the second case.
svgeesus commentedon Jan 11, 2026
I'm seeing the same code in the spec
initramfs commentedon Jan 11, 2026
@svgeesus Might you be looking at line 75 (snippet below):
instead of line 103 (snippet below):
I still see the discrepancy in the spec document you sent, and it still appears to be present in the current main commit:
csswg-drafts/css-color-4/deltaE2000.js
Line 103 in c2e52f7
svgeesus commentedon Jan 16, 2026
Ah, yes indeed.
svgeesus commentedon Jan 16, 2026
Closed by #13338