-
Notifications
You must be signed in to change notification settings - Fork 71
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
Allow creating Color
s in a const context.
#135
Conversation
Fixes #77 |
I'm sorry, but this is way out of scope. |
Thats not a problem. from_unchecked_rgba is all I should really need. I deleted the rest. |
@jeffreyrosenbluth We (Linebender) also have a new color crate, https://github.com/linebender/color/... it has the named colors and more and we'll be releasing a 0.2.0 release o fit soon as we're integrating it now with Peniko and Vello. You might give it a look as well. I'd love to see us get a couple of additional crates that use |
@waywardmonkeys Your color crate looks very nice. How does it differ from the palette crate? |
/// All values must be in 0..=1 range. | ||
pub const unsafe fn from_unchecked_rgba(r: f32, g: f32, b: f32, a: f32) -> Self { | ||
Color { | ||
r: NormalizedF32::new_unchecked(r), |
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.
In theory, this could use a safety comment. In practise, the safety comment is the "unit" safety comment that preconditions are guaranteed by caller.
yes that's a better name Co-authored-by: Daniel McNab <[email protected]>
Added a const function to create Color types and used it to create a module for W3C color names