fixed 8 bit color convertion bug
This commit is contained in:
1 parent
a4fdb22197
commit
1cc5c637e7
1 file changed
+3
-3
+3
-3
@@ -356,9 +356,9 @@ pub fn convert(mode: RenderingMode, c: Color) -> Color {
|
|||||||
let idx = 232 + (rgb[0] as u16 * 23 / 255) as u8;
|
let idx = 232 + (rgb[0] as u16 * 23 / 255) as u8;
|
||||||
Color::Indexed(idx)
|
Color::Indexed(idx)
|
||||||
} else {
|
} else {
|
||||||
let r = (rgb[0] as u16 * 6) / 255;
|
let r = (rgb[0] as u16 * 5) / 255;
|
||||||
let g = (rgb[1] as u16 * 6) / 255;
|
let g = (rgb[1] as u16 * 5) / 255;
|
||||||
let b = (rgb[2] as u16 * 6) / 255;
|
let b = (rgb[2] as u16 * 5) / 255;
|
||||||
let idx = 16 + r * 36 + g * 6 + b;
|
let idx = 16 + r * 36 + g * 6 + b;
|
||||||
Color::Indexed(idx as u8)
|
Color::Indexed(idx as u8)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user