From d2dc2f0ecc2e512497ba9003c7fc59353cd3f733 Mon Sep 17 00:00:00 2001 From: KoffeinFlummi Date: Sun, 31 Mar 2019 21:40:32 +0200 Subject: [PATCH] Tweak progress bar style --- src/config.rs | 1 + src/theme.rs | 4 ++++ src/ui/statusbar.rs | 15 +++++++++------ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/config.rs b/src/config.rs index ef67666..28ab330 100644 --- a/src/config.rs +++ b/src/config.rs @@ -26,6 +26,7 @@ pub struct ConfigTheme { pub error: Option, pub error_bg: Option, pub statusbar_progress: Option, + pub statusbar_progress_bg: Option, pub statusbar: Option, pub statusbar_bg: Option, pub cmdline: Option, diff --git a/src/theme.rs b/src/theme.rs index d1ee511..5651bb3 100644 --- a/src/theme.rs +++ b/src/theme.rs @@ -34,6 +34,10 @@ pub fn load(cfg: &Config) -> Theme { "statusbar_progress", load_color!(cfg, statusbar_progress, Dark(Blue)), ); + palette.set_color( + "statusbar_progress_bg", + load_color!(cfg, statusbar_progress_bg, Light(Black)), + ); palette.set_color("statusbar", load_color!(cfg, statusbar, Dark(Yellow))); palette.set_color( "statusbar_bg", diff --git a/src/ui/statusbar.rs b/src/ui/statusbar.rs index cfa0c8a..03fb82c 100644 --- a/src/ui/statusbar.rs +++ b/src/ui/statusbar.rs @@ -39,6 +39,10 @@ impl View for StatusBar { ColorType::Color(*printer.theme.palette.custom("statusbar_progress").unwrap()), ColorType::Palette(PaletteColor::Background), ); + let style_bar_bg = ColorStyle::new( + ColorType::Color(*printer.theme.palette.custom("statusbar_progress_bg").unwrap()), + ColorType::Palette(PaletteColor::Background), + ); let style = ColorStyle::new( ColorType::Color(*printer.theme.palette.custom("statusbar").unwrap()), ColorType::Color(*printer.theme.palette.custom("statusbar_bg").unwrap()), @@ -100,6 +104,10 @@ impl View for StatusBar { } .to_string(); + printer.with_color(style_bar_bg, |printer| { + printer.print((0, 0), &"┉".repeat(printer.size.x)); + }); + if let Some(ref t) = self.queue.get_current() { let elapsed = self.spotify.get_current_progress(); let elapsed_ms = elapsed.as_secs() as u32 * 1000 + elapsed.subsec_millis(); @@ -120,9 +128,8 @@ impl View for StatusBar { }); printer.with_color(style_bar, |printer| { - printer.print((0, 0), &"—".repeat(printer.size.x)); let duration_width = (((printer.size.x as u32) * elapsed_ms) / t.duration) as usize; - printer.print((0, 0), &format!("{}{}", "=".repeat(duration_width), ">")); + printer.print((0, 0), &"━".repeat(duration_width + 1)); }); } else { let right = repeat + &shuffle; @@ -131,10 +138,6 @@ impl View for StatusBar { printer.with_color(style, |printer| { printer.print((offset, 1), &right); }); - - printer.with_color(style_bar, |printer| { - printer.print((0, 0), &"—".repeat(printer.size.x)); - }); } }