From 4eac5c68391925583e65975c92b576ae21736bac Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Wed, 22 Feb 2023 15:08:43 -0500 Subject: [PATCH] fix(theme): better progress bar colors and update cosmic-theme --- src/theme/mod.rs | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/theme/mod.rs b/src/theme/mod.rs index 05366419..d0cad748 100644 --- a/src/theme/mod.rs +++ b/src/theme/mod.rs @@ -10,9 +10,7 @@ use std::hash::Hasher; pub use self::segmented_button::SegmentedButton; use cosmic_theme::Component; -use cosmic_theme::CosmicPalette; use iced_core::BorderRadius; -use iced_lazy::component; use iced_style::application; use iced_style::button; use iced_style::checkbox; @@ -36,7 +34,6 @@ type CosmicColor = ::palette::rgb::Srgba; type CosmicComponent = cosmic_theme::Component; type CosmicTheme = cosmic_theme::Theme; type CosmicThemeCss = cosmic_theme::Theme; -type CosmicPaletteCss = cosmic_theme::Theme; lazy_static::lazy_static! { pub static ref COSMIC_DARK: CosmicTheme = CosmicThemeCss::dark_default().into_srgba(); @@ -648,16 +645,22 @@ impl progress_bar::StyleSheet for Theme { fn appearance(&self, style: &Self::Style) -> progress_bar::Appearance { let theme = self.cosmic(); - let from_palette = |bar: cosmic_theme::Component<_>| progress_bar::Appearance { - background: Color::from(bar.base).into(), - bar: Color::from(bar.on).into(), - border_radius: 2.0, - }; - match style { - ProgressBar::Primary => from_palette(theme.basic.clone()), - ProgressBar::Success => from_palette(theme.success.clone()), - ProgressBar::Danger => from_palette(theme.destructive.clone()), + ProgressBar::Primary => progress_bar::Appearance { + background: Color::from(theme.divider).into(), + bar: Color::from(theme.accent.base).into(), + border_radius: 2.0, + }, + ProgressBar::Success => progress_bar::Appearance { + background: Color::from(theme.divider).into(), + bar: Color::from(theme.success.base).into(), + border_radius: 2.0, + }, + ProgressBar::Danger => progress_bar::Appearance { + background: Color::from(theme.divider).into(), + bar: Color::from(theme.destructive.base).into(), + border_radius: 2.0, + }, ProgressBar::Custom(f) => f(self), } }