diff --git a/src/app_tray/mod.rs b/src/app_tray/mod.rs index b2fd65b..83a55b7 100644 --- a/src/app_tray/mod.rs +++ b/src/app_tray/mod.rs @@ -197,8 +197,8 @@ fn get_horizontal_rule<'a>( } else { iced::widget::container( iced::widget::horizontal_rule(1) - .style(|_| iced::widget::rule::Style { - color: Color::WHITE, + .style(|theme: &Theme| iced::widget::rule::Style { + color: theme.palette().primary, width: 2, radius: 4.into(), fill_mode: iced::widget::rule::FillMode::Full, @@ -220,81 +220,30 @@ fn get_default_icon() -> Option { } fn tray_button_style<'a>( - _theme: &Theme, + theme: &Theme, status: button::Status, app_info: &ApplicationGroup, active_window: &Option<&WindowHandle>, ) -> button::Style { - let (border_color, background_color) = if app_info.toplevels.is_empty() { - ( - Color { - r: 1.0, - g: 1.0, - b: 1.0, - a: if matches!(status, button::Status::Hovered | button::Status::Pressed) { - 0.11 - } else { - 0.0 - }, - }, - Color { - r: 1.0, - g: 1.0, - b: 1.0, - a: if matches!(status, button::Status::Hovered | button::Status::Pressed) { - 0.1 - } else { - 0.0 - }, - }, - ) + let mut border_color = theme.palette().primary; + let mut background_color = theme.palette().primary; + (border_color.a, background_color.a) = if app_info.toplevels.is_empty() { + if matches!(status, button::Status::Hovered | button::Status::Pressed) { + (0.11, 0.1) + } else { + (0.0, 0.0) + } + } else if active_window.is_some_and(|x| app_info.toplevels.contains_key(x)) { + if matches!(status, button::Status::Hovered | button::Status::Pressed) { + (0.21, 0.2) + } else { + (0.11, 0.1) + } } else { - if active_window.is_some_and(|x| app_info.toplevels.contains_key(x)) { - ( - Color { - r: 1.0, - g: 1.0, - b: 1.0, - a: if matches!(status, button::Status::Hovered | button::Status::Pressed) { - 0.21 - } else { - 0.11 - }, - }, - Color { - r: 1.0, - g: 1.0, - b: 1.0, - a: if matches!(status, button::Status::Hovered | button::Status::Pressed) { - 0.2 - } else { - 0.1 - }, - }, - ) + if matches!(status, button::Status::Hovered | button::Status::Pressed) { + (0.11, 0.1) } else { - ( - Color { - r: 1.0, - g: 1.0, - b: 1.0, - a: if matches!(status, button::Status::Hovered | button::Status::Pressed) { - 0.11 - } else { - 0.06 - }, - }, - Color { - r: 1.0, - g: 1.0, - b: 1.0, - a: if matches!(status, button::Status::Hovered | button::Status::Pressed) { - 0.1 - } else { - 0.05 - }, - }, - ) + (0.06, 0.05) } }; diff --git a/src/panel.rs b/src/panel.rs index 2f0f8b8..fdb96f7 100644 --- a/src/panel.rs +++ b/src/panel.rs @@ -32,7 +32,6 @@ impl<'a> Panel<'a> { #[derive(Clone, Debug)] pub enum Message { - Panic, AppTray(AppTrayMessage), SettingsTray(SettingsTrayMessage), } @@ -48,15 +47,16 @@ impl<'a> Application for Panel<'a> { (Panel::new(flags), Command::::none()) } + fn theme(&self, _id: iced::window::Id) -> Self::Theme { + Theme::Dark + } + fn title(&self, _id: iced::window::Id) -> String { "Window".into() } fn update(&mut self, message: Self::Message) -> iced::Command { match message { - Message::Panic => { - panic!("Panic button pressed hehe"); - } Message::AppTray(app_tray_msg) => self .app_tray .handle_message(app_tray_msg) @@ -83,20 +83,14 @@ impl<'a> Application for Panel<'a> { bottom: 0.0, }); iced::widget::container(column![ - iced::widget::horizontal_rule(1).style(|_| iced::widget::rule::Style { - color: Color { - r: 1.0, - g: 1.0, - b: 1.0, - a: 0.3, - }, + iced::widget::horizontal_rule(1).style(|theme: &Theme| iced::widget::rule::Style { + color: theme.palette().primary.inverse(), width: 1, radius: Radius::from(0), fill_mode: iced::widget::rule::FillMode::Full }), panel_items ]) - .style(|theme| self.panel_style(theme)) .fill() .into() } @@ -108,17 +102,3 @@ impl<'a> Application for Panel<'a> { ]) } } - -impl<'a> Panel<'a> { - fn panel_style(&self, _theme: &Theme) -> iced::widget::container::Style { - iced::widget::container::Style { - background: Some(Background::Color(Color { - r: 30.0 / 256.0, - g: 30.0 / 256.0, - b: 30.0 / 256.0, - a: 1.0, - })), - ..Default::default() - } - } -} diff --git a/src/settings_tray/clock.rs b/src/settings_tray/clock.rs index ad3cdcd..74301e3 100644 --- a/src/settings_tray/clock.rs +++ b/src/settings_tray/clock.rs @@ -43,12 +43,10 @@ impl Clock { iced::widget::container(column![ iced::widget::text!("{}", self.time) .horizontal_alignment(iced::alignment::Horizontal::Center) - .size(14) - .style(white_text), + .size(14), iced::widget::text!("{}", self.date) .horizontal_alignment(iced::alignment::Horizontal::Center) .size(10) - .style(white_text) ]) .center_y(Length::Fill) .into() @@ -91,9 +89,3 @@ impl Clock { ) } } - -fn white_text(_theme: &iced::Theme) -> iced::widget::text::Style { - Style { - color: Some(Color::WHITE), - } -}