about summary refs log tree commit diff
path: root/src/color.rs
diff options
context:
space:
mode:
authorGenny <gen@nyble.dev>2021-09-15 22:16:30 -0500
committerGenny <gen@nyble.dev>2021-09-15 22:16:30 -0500
commit7b8081a79fb3db4a76f9e4cca8f8a88e6e7f873c (patch)
tree5eab8cbf47698b031c12f8eadc4c55f674f70c01 /src/color.rs
parentcdedae673268c372beb27c6d2f123cdf21f630f1 (diff)
downloadgifed-7b8081a79fb3db4a76f9e4cca8f8a88e6e7f873c.tar.gz
gifed-7b8081a79fb3db4a76f9e4cca8f8a88e6e7f873c.zip
Reading, fix writing, monocommit
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],
+        }
+    }
+}