diff options
author | 2020-01-02 14:10:18 +0100 | |
---|---|---|
committer | 2020-01-02 14:25:13 +0100 | |
commit | bf8f83decc039494d310f6ecbb05cbab2c241cbf (patch) | |
tree | c72d0aea3cdb81ef945c3ef0dd65bac25c47be0e /wgpu | |
parent | d60f3b89a75f5b2ad8e6fb17827f5574a0a44bd1 (diff) | |
download | iced-bf8f83decc039494d310f6ecbb05cbab2c241cbf.tar.gz iced-bf8f83decc039494d310f6ecbb05cbab2c241cbf.tar.bz2 iced-bf8f83decc039494d310f6ecbb05cbab2c241cbf.zip |
change(widget): custom coloring for progressbar
Diffstat (limited to 'wgpu')
-rw-r--r-- | wgpu/src/renderer/widget/progressbar.rs | 12 |
1 files changed, 9 insertions, 3 deletions
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<f32>, value: f32, + background: Option<Background>, + active_color: Option<Color>, ) -> 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, }; ( |