Chore: cleanup

This commit is contained in:
Dorian Zedler 2023-03-11 21:15:40 +01:00
parent f2b3e73212
commit e12bec0b13
Signed by: dozedler
GPG key ID: 989DE36109AFA354

View file

@ -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;
}
}