-
Notifications
You must be signed in to change notification settings - Fork 61
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
Add hwb color #53
Add hwb color #53
Conversation
Did not implement Saturate for Hwb. Is it needed? |
Ah, nice! I'll look at this later, when my brain has received some nourishment.
It shouldn't if it can't be done in a trivial way. I'm not exactly sure in this case, but maybe it's enough to scale both the B and W components. |
impl<T: Float> Limited for Hwb<T> { | ||
fn is_valid(&self) -> bool { | ||
self.blackness >= T::zero() && self.blackness <= T::one() && | ||
self.whiteness >= T::zero() && self.whiteness <= T::one() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably a good idea to have the sum check here, as well.
I think that was all. We can leave out |
I just derived the saturate formula from hsv as
This will exactly match the saturation in Hsv from space. However it does not match the saturation from Hsl space
Not sure if saturation should be equivalent in the HSL and HSV spaces. Should I implement this saturation? |
HSL and HSV are affected by the difference between lightness and value. |
Just wanted to confirm that the clamp_self check for 0 to infinity makes sense right? For all other colors we have checked 0-1, but here we are normalizing.
|
Yes, the normalization makes it ok. You can't fool it by making one parameter negative, since it would be clamped to 0. I just realized that |
I updated Limited to use max fn instead of clamp. Should be good to go! |
Great! I'll merge as soon as the tests are green. Thank you! |
@homu r+ |
📌 Commit 5cee7ab has been approved by |
⚡ Test exempted - status |
Add hwb color Added support for HWB color model. Added tests, implemented Alpha, ApproxEq, FromColor and IntoColor traits and added to color enum. closes #32
Added support for HWB color model.
Added tests, implemented Alpha, ApproxEq, FromColor and IntoColor traits and added to color enum.
closes #32