From bf8f83decc039494d310f6ecbb05cbab2c241cbf Mon Sep 17 00:00:00 2001 From: Songtronix Date: Thu, 2 Jan 2020 14:10:18 +0100 Subject: change(widget): custom coloring for progressbar --- wgpu/src/renderer/widget/progressbar.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'wgpu/src') diff --git a/wgpu/src/renderer/widget/progressbar.rs b/wgpu/src/renderer/widget/progressbar.rs index 3c62e54d..f621343d 100644 --- a/wgpu/src/renderer/widget/progressbar.rs +++ b/wgpu/src/renderer/widget/progressbar.rs @@ -11,6 +11,8 @@ impl progressbar::Renderer for Renderer { bounds: Rectangle, range: std::ops::RangeInclusive, value: f32, + background: Option, + active_color: Option, ) -> Self::Output { let (range_start, range_end) = range.into_inner(); let active_progress_width = bounds.width @@ -19,7 +21,9 @@ impl progressbar::Renderer for Renderer { let background = Primitive::Group { primitives: vec![Primitive::Quad { bounds: Rectangle { ..bounds }, - background: Color::from_rgb(0.6, 0.6, 0.6).into(), + background: background + .unwrap_or(Background::Color([0.6, 0.6, 0.6].into())) + .into(), border_radius: 5, }], }; @@ -29,8 +33,10 @@ impl progressbar::Renderer for Renderer { width: active_progress_width, ..bounds }, - background: Background::Color([0.0, 0.95, 0.0].into()), - border_radius: 4, + background: Background::Color( + active_color.unwrap_or([0.0, 0.95, 0.0].into()), + ), + border_radius: 5, }; ( -- cgit