From 7dde4e9b03de40fbd0b8be669e4eb52b3d3acc2b Mon Sep 17 00:00:00 2001 From: Yuki Sireneva Date: Fri, 10 Jul 2026 21:51:27 +0000 Subject: [PATCH] Make progress_bar inherit background --- cursive-core/src/views/progress_bar.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cursive-core/src/views/progress_bar.rs b/cursive-core/src/views/progress_bar.rs index b22cbd585..71127379b 100644 --- a/cursive-core/src/views/progress_bar.rs +++ b/cursive-core/src/views/progress_bar.rs @@ -1,5 +1,5 @@ use crate::align::HAlign; -use crate::style::{ColorStyle, ColorType, Effect, PaletteColor}; +use crate::style::{ColorStyle, ColorType, PaletteColor}; use crate::utils::Counter; use crate::view::View; use crate::{Printer, With}; @@ -295,14 +295,14 @@ impl View for ProgressBar { let offset = HAlign::Center.get_offset(label.len(), printer.size.x); let color_style = ColorStyle::new(PaletteColor::HighlightText, self.color); + let reverse_style = ColorStyle::new(self.color, ColorType::InheritParent); + + printer.with_color(reverse_style, |printer| { + printer.print((length, 0), sub_block(extra)); + printer.print((offset, 0), &label); + }); printer.with_color(color_style, |printer| { - // TODO: Instead, write it with self.color and inherit_parent background? - // Draw the right half of the label in reverse - printer.with_effect(Effect::Reverse, |printer| { - printer.print((length, 0), sub_block(extra)); - printer.print((offset, 0), &label); - }); let printer = &printer.cropped((length, 1)); printer.print_hline((0, 0), length, " ");