Skip to content
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

Handle invalid color channel values from pl/color-xyz-to-apply-rgb #171

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

schellj
Copy link

@schellj schellj commented Aug 6, 2019

With the existing pl/color-xyz-to-apply-rgb function, it's possible that pl/hex-color will generate a -0.0e+NaN color channel value for certain colors, such as those with zero B and/or G values. This will either result in an incorrect displayed color (e.g., in Emacs 26.2) or cause an error to be thrown (e.g., in Emacs 27.0). It's also possible that pl/color-xyz-to-apply-rgb will generate color channel values slightly outside of the valid range of 0.0 - 1.0, though that doesn't seem to cause any particular issues for Emacs.

Screenshots below from a test function comparing the changes in this PR with master and the core color-rgb-to-hex.

Emacs 26.2:
powerline-separators-PR-26 2

Emacs 27.0:
powerline-separators-PR-27 0

See https://gist.github.com/schellj/3a0ff288936322b59006d497bf607351 for the test function that I used for the screenshots above function (copy the PR pl/color-xyz-to-apple-rgb to schellj/color-xyz-to-apple-rgb).

I spent a long time (too much time) trying to figure out if the pl/color-xyz-to-apply-rgb matrix transformation was incorrect or if there was a better one, but that effort was unfruitful. Thus, I opted to just catch and handle the invalid color channel values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant