fix: card style

This commit is contained in:
Ashley Wulber 2025-04-30 15:32:41 -04:00 committed by Michael Murphy
parent 264b9d8367
commit 8fa4b1cae2
2 changed files with 21 additions and 22 deletions

View file

@ -24,3 +24,24 @@ pub trait Catalog {
/// The default [`Appearance`] of the cards.
fn default(&self) -> Style;
}
impl crate::widget::card::style::Catalog for crate::Theme {
fn default(&self) -> crate::widget::card::style::Style {
let cosmic = self.cosmic();
match self.layer {
cosmic_theme::Layer::Background => crate::widget::card::style::Style {
card_1: Background::Color(cosmic.background.component.hover.into()),
card_2: Background::Color(cosmic.background.component.pressed.into()),
},
cosmic_theme::Layer::Primary => crate::widget::card::style::Style {
card_1: Background::Color(cosmic.primary.component.hover.into()),
card_2: Background::Color(cosmic.primary.component.pressed.into()),
},
cosmic_theme::Layer::Secondary => crate::widget::card::style::Style {
card_1: Background::Color(cosmic.secondary.component.hover.into()),
card_2: Background::Color(cosmic.secondary.component.pressed.into()),
},
}
}
}