BUG: Relative luminance calc in Styler is wrong (and out of date) · Issue #39888 · pandas-dev/pandas (original) (raw)
The relative luminance calculation is described here: https://www.w3.org/WAI/GL/wiki/Relative_luminance. RL is used by Styler.background_gradient()
to determine text-color against background but the calculation is wrongly coded.
In addition a new errata posted suggests that a scalar should be changed (albeit this has minimal impact). The greatest change is had through the re-engineered calculation. See below for before and after.