diff --git a/src/theme/style/iced.rs b/src/theme/style/iced.rs index b1914bfe..05c1a50b 100644 --- a/src/theme/style/iced.rs +++ b/src/theme/style/iced.rs @@ -374,6 +374,7 @@ pub enum Container { Dialog, Dropdown, HeaderBar, + List, Primary, Secondary, Tooltip, @@ -457,6 +458,21 @@ impl container::StyleSheet for Theme { shadow: Shadow::default(), }, + Container::List => { + let component = &self.current_container().component; + + container::Appearance { + icon_color: Some(component.on.into()), + text_color: Some(component.on.into()), + background: Some(Background::Color(component.base.into())), + border: iced::Border { + radius: cosmic.corner_radii.radius_s.into(), + ..Default::default() + }, + shadow: Shadow::default(), + } + } + Container::HeaderBar => container::Appearance { icon_color: Some(Color::from(cosmic.accent.base)), text_color: Some(Color::from(cosmic.background.on)), diff --git a/src/widget/list/mod.rs b/src/widget/list/mod.rs index a08497e8..4de09e52 100644 --- a/src/widget/list/mod.rs +++ b/src/widget/list/mod.rs @@ -9,30 +9,12 @@ pub use self::column::{list_column, ListColumn}; use crate::widget::Container; use crate::Element; -use iced::Background; -use iced_core::Shadow; pub fn container<'a, Message>( content: impl Into>, ) -> Container<'a, Message, crate::Theme, crate::Renderer> { super::container(content) .padding([16, 6]) - .style(crate::theme::Container::custom(style)) + .style(crate::theme::Container::List) .width(iced::Length::Fill) } - -#[must_use] -#[allow(clippy::trivially_copy_pass_by_ref)] -pub fn style(theme: &crate::Theme) -> crate::widget::container::Appearance { - let container = &theme.current_container().component; - crate::widget::container::Appearance { - icon_color: Some(container.on.into()), - text_color: Some(container.on.into()), - background: Some(Background::Color(container.base.into())), - border: iced::Border { - radius: theme.cosmic().corner_radii.radius_s.into(), - ..Default::default() - }, - shadow: Shadow::default(), - } -}