diff --git a/src/main.rs b/src/main.rs index 030d31d..cf0626b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -50,14 +50,17 @@ fn generate_color( unlike: Option<(u8, u8, u8)>, ) -> (u8, u8, u8) { let criteria = |(r, g, b): (u8, u8, u8)| { - if dark_mode && (r as u16 + g as u16 + b as u16) < 100 { + let r = r as u16; + let g = g as u16; + let b = b as u16; + if dark_mode && (r + g + b) < 100 { return false; - } else if !dark_mode && (r as u16 + g as u16 + b as u16) > 600 { + } else if !dark_mode && (r + g + b) > 600 { return false; } if let Some((r1, g1, b1)) = unlike { - if (r.abs_diff(r1) as u16 + g.abs_diff(g1) as u16 + b.abs_diff(b1) as u16) < 200 { + if (r.abs_diff(r1 as u16) + g.abs_diff(g1 as u16) + b.abs_diff(b1 as u16)) < 200 { return false; } }