summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2019-11-07 17:44:27 +0100
committerLibravatar GitHub <noreply@github.com>2019-11-07 17:44:27 +0100
commit59ef7f074c67126dd8bd0ae9cbc82ce2a946258f (patch)
tree5004ae812a39d36b3880d340101806edcf6abd04 /core/src
parent6790f4b6e36f21b5db9ef02f5e499df8336abfea (diff)
parente7bd24c13eb0c5c2b8ecf3f09f9e2de315bf8a41 (diff)
downloadiced-59ef7f074c67126dd8bd0ae9cbc82ce2a946258f.tar.gz
iced-59ef7f074c67126dd8bd0ae9cbc82ce2a946258f.tar.bz2
iced-59ef7f074c67126dd8bd0ae9cbc82ce2a946258f.zip
Merge pull request #46 from memoryruins/from-array
impl From<Array> for Color
Diffstat (limited to 'core/src')
-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 }
+ }
+}