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

Assign neutral colors a hue of 0° when converting to HSL #587

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
1 participant
@klaftertief

klaftertief commented May 4, 2016

Converting a neutral color e.g. black (in RGB representation) to a HSL representation yields a hue value of NaN (because of calling % on Infinity.

import Color

hsl = Color.toHsl (Color.rgb 0 0 0)
-- == { hue = NaN, saturation = 0, lightness = 0, alpha = 1 }

This can be avoided by special casing a chroma of 0 and assigning it a hue of 0.

Assign neutral colors a hue of 0°
Converting a neutral color e.g. black (in RGB representation) to a HSL representation yields a hue value of `NaN`.

```Elm
import Color

hsl = Color.toHsl (Color.rgb 0 0 0)  -- == { hue = NaN, saturation = 0, lightness = 0, alpha = 1 }
```

This can be avoided by special casing a chroma of `0` and assigning it a hue of `0`.

@klaftertief klaftertief changed the title from Assign neutral colors a hue of 0° to Assign neutral colors a hue of 0° when converting to HSL May 4, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment