Add const from_rgba, for RGBA initialization
This commit is contained in:
parent
9a4ad3d6a7
commit
e926e43742
1 changed files with 8 additions and 1 deletions
|
|
@ -65,7 +65,14 @@ impl Color {
|
||||||
///
|
///
|
||||||
/// [`Color`]: struct.Color.html
|
/// [`Color`]: struct.Color.html
|
||||||
pub const fn from_rgb(r: f32, g: f32, b: f32) -> Color {
|
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.
|
/// Creates a [`Color`] from its RGB8 components.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue