summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorLibravatar memoryruins <memoryruinsmusic@gmail.com>2019-11-07 01:02:20 -0500
committerLibravatar memoryruins <memoryruinsmusic@gmail.com>2019-11-07 01:02:20 -0500
commit58bd0824bf458b6a5b21ade1efe998b1439469cd (patch)
tree2082ae55301546705f97ba9422ee3a0d8f30768e /core
parentd568d05df4388bfaa254ee87cca6edd07fc24465 (diff)
downloadiced-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.rs12
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 }
+ }
+}