about summary refs log tree commit diff
path: root/src/color.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/color.rs')
-rw-r--r--src/color.rs25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/color.rs b/src/color.rs
index dc134ef..764acaf 100644
--- a/src/color.rs
+++ b/src/color.rs
@@ -1,11 +1,22 @@
+#[derive(Copy, Clone, Debug)]
 pub struct Color {
-	pub r: u8,
-	pub g: u8,
-	pub b: u8
+    pub r: u8,
+    pub g: u8,
+    pub b: u8,
 }
 
 impl Color {
-	pub fn new(r: u8, g: u8, b: u8) -> Self {
-		Self { r, g, b }
-	}
-}
\ No newline at end of file
+    pub fn new(r: u8, g: u8, b: u8) -> Self {
+        Self { r, g, b }
+    }
+}
+
+impl From<[u8; 3]> for Color {
+    fn from(arr: [u8; 3]) -> Self {
+        Self {
+            r: arr[0],
+            g: arr[1],
+            b: arr[2],
+        }
+    }
+}