2026-05-03 21:57 UTC
@adamhotep@infosec.exchange
I think I just realized... did you linearize first?
The reality is that before the coefficients are applied, the R G B tuples need to be linearized (gamma or TRC removed), otherwise, you won't get the correct luminance value... that could explain why your flip point seems inverted... The sRGB piecewise TRC is "official" but a 2.2 gamma works:
```
let Y = (sR/255.0)**2.2*0.2126+(sG/255.0)**2.2*0.7152+(sB/255.0)**2.2*0.0722 ;
let text = Y > 0.37 ? "#000" : "#fff" ;
```
Replies (1)
-
@adamhotep@infosec.exchange 2026-05-03 22:01
@Myndex@techhub.social I'll have to look at that, thanks for the tips. (This is low priority for me since what I have works.)