reuse existing function
This commit is contained in:
parent
f1a0c5ce61
commit
eb8fd556e4
|
@ -9,9 +9,7 @@ pub struct Colour {
|
||||||
|
|
||||||
impl From<&str> for Colour {
|
impl From<&str> for Colour {
|
||||||
fn from(str: &str) -> Self {
|
fn from(str: &str) -> Self {
|
||||||
let rgb = hex::decode(&str[str.len() - 6..]).unwrap();
|
Self::from(hex::decode(&str[str.len() - 6..]).unwrap())
|
||||||
|
|
||||||
Colour { red: rgb[0], green: rgb[1], blue: rgb[2] }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue