From 874b674a44ee4bbc7dc907f6bbd6e06d81007de7 Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Wed, 13 Aug 2025 21:22:39 +0200 Subject: [PATCH] fix(appearance): use image buttons to get selection icons --- .../desktop/appearance/mode_and_colors.rs | 23 +++++++++++-------- .../src/pages/desktop/appearance/style.rs | 15 +++++++----- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/cosmic-settings/src/pages/desktop/appearance/mode_and_colors.rs b/cosmic-settings/src/pages/desktop/appearance/mode_and_colors.rs index 938b296..de68509 100644 --- a/cosmic-settings/src/pages/desktop/appearance/mode_and_colors.rs +++ b/cosmic-settings/src/pages/desktop/appearance/mode_and_colors.rs @@ -250,10 +250,11 @@ fn theme_mode<'a>( container( cosmic::iced::widget::row![ cosmic::iced::widget::column![ - button::custom( + button::custom_image_button( icon(dark_mode_illustration) .width(Length::Fixed(191.0)) - .height(Length::Fixed(100.0)) + .height(Length::Fixed(100.0)), + None ) .class(button::ButtonClass::Image) .padding([8, 0]) @@ -265,10 +266,11 @@ fn theme_mode<'a>( .width(Length::FillPortion(1)) .align_x(Alignment::Center), cosmic::iced::widget::column![ - button::custom( + button::custom_image_button( icon(light_mode_illustration,) .width(Length::Fixed(191.0)) - .height(Length::Fixed(100.0)) + .height(Length::Fixed(100.0)), + None ) .class(button::ButtonClass::Image) .selected(!page.theme_manager.mode().is_dark) @@ -295,12 +297,15 @@ pub fn color_button<'a, Message: 'a + Clone>( width: u16, height: u16, ) -> Element<'a, Message> { - button::custom(color_image( - wallpaper::Color::Single([color.r, color.g, color.b]), - width, - height, + button::custom_image_button( + color_image( + wallpaper::Color::Single([color.r, color.g, color.b]), + width, + height, + None, + ), None, - )) + ) .padding(0) .selected(selected) .class(button::ButtonClass::Image) diff --git a/cosmic-settings/src/pages/desktop/appearance/style.rs b/cosmic-settings/src/pages/desktop/appearance/style.rs index cef84e1..1b2ec12 100644 --- a/cosmic-settings/src/pages/desktop/appearance/style.rs +++ b/cosmic-settings/src/pages/desktop/appearance/style.rs @@ -53,7 +53,7 @@ pub fn section() -> Section { container( cosmic::iced::widget::row![ cosmic::iced::widget::column![ - button::custom( + button::custom_image_button( icon( if page.theme_manager.mode().is_dark { &dark_round_style @@ -63,7 +63,8 @@ pub fn section() -> Section { .clone() ) .width(Length::Fill) - .height(Length::Fixed(100.0)) + .height(Length::Fixed(100.0)), + None ) .selected(matches!(page.roundness, Roundness::Round)) .class(button::ButtonClass::Image) @@ -78,7 +79,7 @@ pub fn section() -> Section { .width(Length::FillPortion(1)) .align_x(Alignment::Center), cosmic::iced::widget::column![ - button::custom( + button::custom_image_button( icon( if page.theme_manager.mode().is_dark { &dark_slightly_round_style @@ -88,7 +89,8 @@ pub fn section() -> Section { .clone() ) .width(Length::Fill) - .height(Length::Fixed(100.0)) + .height(Length::Fixed(100.0)), + None ) .selected(matches!(page.roundness, Roundness::SlightlyRound)) .class(button::ButtonClass::Image) @@ -103,7 +105,7 @@ pub fn section() -> Section { .width(Length::FillPortion(1)) .align_x(Alignment::Center), cosmic::iced::widget::column![ - button::custom( + button::custom_image_button( icon( if page.theme_manager.mode().is_dark { &dark_square_style @@ -113,7 +115,8 @@ pub fn section() -> Section { .clone() ) .width(Length::Fill) - .height(Length::Fixed(100.0)) + .height(Length::Fixed(100.0)), + None ) .width(Length::FillPortion(1)) .selected(matches!(page.roundness, Roundness::Square))