impl From<Array> for Color
This commit is contained in:
parent
d568d05df4
commit
58bd0824bf
1 changed files with 12 additions and 0 deletions
|
|
@ -44,3 +44,15 @@ impl Color {
|
|||
]
|
||||
}
|
||||
}
|
||||
|
||||
impl From<[f32; 3]> for Color {
|
||||
fn from([r, g, b]: [f32; 3]) -> Self {
|
||||
Color { r, g, b, a: 1.0 }
|
||||
}
|
||||
}
|
||||
|
||||
impl From<[f32; 4]> for Color {
|
||||
fn from([r, g, b, a]: [f32; 4]) -> Self {
|
||||
Color { r, g, b, a }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue