Add const from_rgba, for RGBA initialization

This commit is contained in:
Clark Moody 2020-03-31 16:41:07 -05:00
parent 9a4ad3d6a7
commit e926e43742

View file

@ -65,7 +65,14 @@ impl Color {
///
/// [`Color`]: struct.Color.html
pub const fn from_rgb(r: f32, g: f32, b: f32) -> Color {
Color { r, g, b, a: 1.0 }
Color::from_rgba(r, g, b, 1.0f32)
}
/// Creates a [`Color`] from its RGBA components.
///
/// [`Color`]: struct.Color.html
pub const fn from_rgba(r: f32, g: f32, b: f32, a: f32) -> Color {
Color { r, g, b, a }
}
/// Creates a [`Color`] from its RGB8 components.