-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Add Color::srgb_u32 #14454
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
base: main
Are you sure you want to change the base?
Add Color::srgb_u32 #14454
Conversation
/// | ||
/// For example, a value of `0x000000` results in black, and a value of `0xff0000` results in red. | ||
pub fn srgb_u32(color: u32) -> Self { | ||
Self::Srgba(Srgba { |
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.
This should call an equivalent public method on Srgba
:)
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.
I still want this comment resolved :)
@amytimed thanks for such an useful contribution! Would you be able to address the comments? I think this PR is an easy win if you include the requested additions. |
Objective
Allows using a color value like
0xffffff
.Instead of doing this:
This PR allows doing this:
Solution
New method
srgb_u32
, similar tosrgb_u8
but all in one value.