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.rs18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/color.rs b/src/color.rs
index 764acaf..dd96280 100644
--- a/src/color.rs
+++ b/src/color.rs
@@ -1,4 +1,4 @@
-#[derive(Copy, Clone, Debug)]
+#[derive(Copy, Clone, Debug, PartialEq)]
 pub struct Color {
     pub r: u8,
     pub g: u8,
@@ -20,3 +20,19 @@ impl From<[u8; 3]> for Color {
         }
     }
 }
+
+impl From<(u8, u8, u8)> for Color {
+    fn from(t: (u8, u8, u8)) -> Self {
+        Self {
+            r: t.0,
+            g: t.1,
+            b: t.2,
+        }
+    }
+}
+
+impl Into<[u8; 3]> for Color {
+    fn into(self) -> [u8; 3] {
+        [self.r, self.g, self.b]
+    }
+}