fixed 8 bit color convertion bug

This commit is contained in:
Evan Almloff committed 2022-02-27 06:52:35 -06:00
1 parent a4fdb22197
commit 1cc5c637e7
1 file changed
+3 -3
+3 -3
View File
@@ -356,9 +356,9 @@ pub fn convert(mode: RenderingMode, c: Color) -> Color {
let idx = 232 + (rgb[0] as u16 * 23 / 255) as u8;
Color::Indexed(idx)
} else {
let r = (rgb[0] as u16 * 6) / 255;
let g = (rgb[1] as u16 * 6) / 255;
let b = (rgb[2] as u16 * 6) / 255;
let r = (rgb[0] as u16 * 5) / 255;
let g = (rgb[1] as u16 * 5) / 255;
let b = (rgb[2] as u16 * 5) / 255;
let idx = 16 + r * 36 + g * 6 + b;
Color::Indexed(idx as u8)
}