{"action":"created","issue":{"url":"https://api.github.com/repos/Ogeon/palette/issues/45","repository_url":"https://api.github.com/repos/Ogeon/palette","labels_url":"https://api.github.com/repos/Ogeon/palette/issues/45/labels{/name}","comments_url":"https://api.github.com/repos/Ogeon/palette/issues/45/comments","events_url":"https://api.github.com/repos/Ogeon/palette/issues/45/events","html_url":"https://github.com/Ogeon/palette/issues/45","id":132482488,"number":45,"title":"Need for HueType","user":{"login":"sidred","id":6623285,"avatar_url":"https://avatars.githubusercontent.com/u/6623285?v=3","gravatar_id":"","url":"https://api.github.com/users/sidred","html_url":"https://github.com/sidred","followers_url":"https://api.github.com/users/sidred/followers","following_url":"https://api.github.com/users/sidred/following{/other_user}","gists_url":"https://api.github.com/users/sidred/gists{/gist_id}","starred_url":"https://api.github.com/users/sidred/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sidred/subscriptions","organizations_url":"https://api.github.com/users/sidred/orgs","repos_url":"https://api.github.com/users/sidred/repos","events_url":"https://api.github.com/users/sidred/events{/privacy}","received_events_url":"https://api.github.com/users/sidred/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-02-09T17:34:06Z","updated_at":"2016-02-10T03:55:05Z","closed_at":null,"body":"I was trying the Hsl type and it seems inconsistent with the rest of the library.\r\n\r\n1) All the other colors take floats for new, but hsl needs ```Hsl::new((240.0).into(), 0.0, 0.0)```\r\n\r\n2) You input the hue as 240, but you cannot use hsl.hue, you need to use ```hsl.hue.to_positive_degrees()```. I have been looking at this code for past few weeks and I made this mistake. This is going to be a very common issue. There is no compile error, but the code will not work as expected.\r\n\r\n3) I don't see the need for ```hsl + 0.1```. I would rather this be a compile time error, because this is most likely a typo. The values are not on the same scale and does not make sense.\r\n\r\nWhat do you think of removing the huetype and storing the hues as 0-360 floats? I understand that HueType avoids some issues in the code, but maybe we can mitigate it by using more test cases?\r\n"},"comment":{"url":"https://api.github.com/repos/Ogeon/palette/issues/comments/182185913","html_url":"https://github.com/Ogeon/palette/issues/45#issuecomment-182185913","issue_url":"https://api.github.com/repos/Ogeon/palette/issues/45","id":182185913,"user":{"login":"sidred","id":6623285,"avatar_url":"https://avatars.githubusercontent.com/u/6623285?v=3","gravatar_id":"","url":"https://api.github.com/users/sidred","html_url":"https://github.com/sidred","followers_url":"https://api.github.com/users/sidred/followers","following_url":"https://api.github.com/users/sidred/following{/other_user}","gists_url":"https://api.github.com/users/sidred/gists{/gist_id}","starred_url":"https://api.github.com/users/sidred/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sidred/subscriptions","organizations_url":"https://api.github.com/users/sidred/orgs","repos_url":"https://api.github.com/users/sidred/repos","events_url":"https://api.github.com/users/sidred/events{/privacy}","received_events_url":"https://api.github.com/users/sidred/received_events","type":"User","site_admin":false},"created_at":"2016-02-10T03:55:05Z","updated_at":"2016-02-10T03:55:05Z","body":"\r\n#### RgbHue \r\nAdvantages:\r\n- Consistent range.\r\n- Get and set value will auto normalize.\r\n\r\nInconsistencies:\r\n- Add and subtract do not normalize. So internally these values might be beyond the range and partial eq after these operations might fail.\r\n\r\nDownsides:\r\n- Needs explicit casts, especially from RgbHue to f32. Literal struct initialization needs into() cast. new() function can be modified to take floats. It'll be a compile error though.\r\n- Performance issues due to a lot of unnecessary normalizations.  Might add up when working on a lot of pixels (images etc.)\r\n- Need to standardize on -180  to 180 or 0-360. One additional thing for the user to keep in mind.\r\n\r\n#### Float\r\nAdvantages:\r\n- Consistent with the rest of the library's api.\r\n- Can be directly used as float.\r\n- User can normalize when needed. \r\n- No -180 to 180 or 0 -360 issues. You will just have to consider whether the value is normalized or not.\r\n\r\nDisadvantages:\r\n- User has to manually normalize the values and it is not apparent when it needs to be done. Easy mistake to make assuming 0-360 after addition or subtraction.\r\n\r\nfunction like normalize, to_radians, from radians can be standalone functions that work on floats.\r\n"}}