1 2 3 4 5 6
pub fn hex_to_rgb(hex: &str) -> Result<[u8; 3], std::num::ParseIntError> { let r = u8::from_str_radix(&hex[0..2], 16)?; let g = u8::from_str_radix(&hex[2..4], 16)?; let b = u8::from_str_radix(&hex[4..6], 16)?; Ok([r, g, b]) }