From d2ed0152f1a48bec3b84e5602944221ddf13071f Mon Sep 17 00:00:00 2001 From: Robert Martin Winterstein Date: Sun, 7 Oct 2018 15:10:58 -0600 Subject: fix erroneous indexed_color results --- src/term/color.rs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/term/color.rs b/src/term/color.rs index 276a6897..0706f9df 100644 --- a/src/term/color.rs +++ b/src/term/color.rs @@ -101,24 +101,19 @@ impl List { for r in 0..6 { for g in 0..6 { for b in 0..6 { - // Index of the color is number of named colors + rgb - let color_index = 16 + r + g + b; - // Override colors 16..232 with the config (if present) if let Some(indexed_color) = colors .indexed_colors .iter() - .find(|ic| ic.index == color_index) + .find(|ic| ic.index == index as u8) { self[index] = indexed_color.color; - index += 1; - continue; + } else { + self[index] = Rgb { r: if r == 0 { 0 } else { r * 40 + 55 }, + b: if b == 0 { 0 } else { b * 40 + 55 }, + g: if g == 0 { 0 } else { g * 40 + 55 }, + }; } - - self[index] = Rgb { r: if r == 0 { 0 } else { r * 40 + 55 }, - b: if b == 0 { 0 } else { b * 40 + 55 }, - g: if g == 0 { 0 } else { g * 40 + 55 }, - }; index += 1; } } -- cgit