-
-
Notifications
You must be signed in to change notification settings - Fork 119
Added traits: from and display to all color struct #133
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
Conversation
For each colorstruct (Color, Lab, RGB...) traits <From> and <Diplay> are coded. Those are very important when you want simply comvert from one color to another with: `let new_color = Lab::from(&Color)` or `let new_color: Lab = somme_color.into()` Same time another delta_e was added: cir94, which is faster than ciede2000 bu more accurate than cie76. Lastly, a function `nearest` was added that is 5 lines, but, with your premission in the future, i want to add functionality to extract colors fom image, and this function is needed. It simply finds the index and distance from nearest color from a group of colors
Thank you for your contribution! All of these changes sound great, but I would prefer if we could split them into multiple PRs.
This sounds like a useful functionality, but I'm not sure it would really fit into this library. Wouldn't it require new dependencies? |
Yes sure. I think that The changes in |
No. I |
Sure thing. PS: I am building a tool that uses extensively pastel, and along the way, if i see that some functions are better in pastel, I'll make a PR :) |
Some changes added to `delta_e` are reverted back so latter another PR will be added with those changes
To the main struct Color, the display functionality is added and it defaults to HSLA display. Since they are very similar to print the.
Sounds great. Definitely interested to hear more 😄 |
You already have in the main function the print_XXX_string(), which in all cases is a formated version something like
then this
while this
So, if you use the function you build it, then you get a prettier format, but if you don't specify, the |
Yes, I think that's a good idea. Just do the "bare minimum" work in the Display trait. It's meant for debugging, not for pretty-printing (to my knowledge). |
Could you please also add an entry to the "unreleased" section in
where |
Done. :)
Well, there is the |
Thank you! |
For each colorstruct (Color, Lab, RGB...) traits 'From' and 'Diplay'
are coded. Those are very important when you want simply comvert
from one color to another with standard Rust things:
let new_color = Lab::from(&Color)
or
let new_color: Lab = somme_color.into()
In addidtion another delta_e was added: cir94, which is faster
than ciede2000 bu more accurate than cie76.
Lastly, a function
nearest
was added that is 5 lines, but,with your premission in the future, i want to add functionality
to extract colors fom image, and this function is needed. It
simply finds the index and distance from nearest color from a group of
colors