feat(theme): use cosmic-theme

This commit is contained in:
Ashley Wulber 2023-02-27 18:45:54 -05:00 committed by Jeremy Soller
parent becdbb6eb3
commit cbb21932d8
5 changed files with 42 additions and 60 deletions

View file

@ -17,7 +17,11 @@ pub fn cosmic_container<'a, Message: 'static, T>(
where
T: Into<Element<'a, Message, crate::Renderer>>,
{
CosmicContainer::new(content, layer)
CosmicContainer::new(content, layer).style(match layer {
cosmic_theme::Layer::Background => crate::theme::Container::Background,
cosmic_theme::Layer::Primary => crate::theme::Container::Primary,
cosmic_theme::Layer::Secondary => crate::theme::Container::Secondary,
})
}
/// An element decorating some content.
@ -142,7 +146,7 @@ where
}
fn layout(&self, renderer: &Renderer, limits: &layout::Limits) -> layout::Node {
self.container.layout(renderer, &limits)
self.container.layout(renderer, limits)
}
fn operate(&self, tree: &mut Tree, layout: Layout<'_>, operation: &mut dyn Operation<Message>) {

View file

@ -60,7 +60,7 @@ impl<'a, Message: 'static> From<ListColumn<'a, Message>> for Element<'a, Message
#[allow(clippy::trivially_copy_pass_by_ref)]
pub fn style(theme: &crate::Theme) -> iced::widget::container::Appearance {
let cosmic = &theme.cosmic();
let container = cosmic.current_container();
let container = &cosmic.current_container().component;
iced::widget::container::Appearance {
text_color: Some(container.on.into()),
background: Some(Background::Color(container.base.into())),