diff options
author | 2019-11-07 01:02:20 -0500 | |
---|---|---|
committer | 2019-11-07 01:02:20 -0500 | |
commit | 58bd0824bf458b6a5b21ade1efe998b1439469cd (patch) | |
tree | 2082ae55301546705f97ba9422ee3a0d8f30768e /core | |
parent | d568d05df4388bfaa254ee87cca6edd07fc24465 (diff) | |
download | iced-58bd0824bf458b6a5b21ade1efe998b1439469cd.tar.gz iced-58bd0824bf458b6a5b21ade1efe998b1439469cd.tar.bz2 iced-58bd0824bf458b6a5b21ade1efe998b1439469cd.zip |
impl From<Array> for Color
Diffstat (limited to 'core')
-rw-r--r-- | core/src/color.rs | 12 |
1 files changed, 12 insertions, 0 deletions
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 } + } +} |