Skip to content

BUG: Relative luminance calc in Styler is wrong (and out of date) #39888

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
attack68 opened this issue Feb 18, 2021 · 0 comments · Fixed by #39889
Closed

BUG: Relative luminance calc in Styler is wrong (and out of date) #39888

attack68 opened this issue Feb 18, 2021 · 0 comments · Fixed by #39889
Labels
Bug Styler conditional formatting using DataFrame.style Visualization plotting
Milestone

Comments

@attack68
Copy link
Contributor

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.

Screen Shot 2021-02-18 at 17 41 17

@attack68 attack68 added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Feb 18, 2021
@attack68 attack68 added Styler conditional formatting using DataFrame.style Visualization plotting and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Feb 18, 2021
@jreback jreback added this to the 1.3 milestone Feb 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Styler conditional formatting using DataFrame.style Visualization plotting
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants