-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 ability to convert from a hex string to Color32 using macros #1596
Conversation
Very nice! But I would suggest we simplify it. As far as I can recall I've never seen premultiplied alpha expressed in hex form. So I suggest we boil it down to a single macro that accepts both RGB and unmultiplied RGBA ( For additive, users can just do |
Upon further testing, previously the from_rgb, from_rgb_additive, from_rgba_premultiplied were |
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 a bit of a shame that it is not const
but yeah, not much to do about that right now. I think this looks good, but the macro needs a docstring!
is hex string assumed to be in linear space? or sRGB? |
This PR closes #1492.
Again currently
./sh/check.sh
is currently failing for me, see my other PR.Cargo clippy, cargo test, and cargo fmt have all been run.
The CHANGELOG.md has been updated under "Unreleased"
This change allows you to create Color32's from hex strings:
And it does so at compile-time.