From 58bd0824bf458b6a5b21ade1efe998b1439469cd Mon Sep 17 00:00:00 2001 From: memoryruins Date: Thu, 7 Nov 2019 01:02:20 -0500 Subject: impl From for Color --- core/src/color.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'core/src') diff --git a/core/src/color.rs b/core/src/color.rs index 79910dd8..150bd05b 100644 --- a/core/src/color.rs +++ b/core/src/color.rs @@ -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 } + } +} -- cgit