cosmic/widget/card/
style.rs
1use iced_core::{Background, Color};
5
6#[derive(Clone, Copy)]
8pub struct Style {
9 pub card_1: Background,
10 pub card_2: Background,
11}
12
13impl Default for Style {
14 fn default() -> Self {
15 Self {
16 card_1: Background::Color(Color::WHITE),
17 card_2: Background::Color(Color::WHITE),
18 }
19 }
20}
21
22pub trait Catalog {
24 fn default(&self) -> Style;
26}
27
28impl crate::widget::card::style::Catalog for crate::Theme {
29 fn default(&self) -> crate::widget::card::style::Style {
30 let cosmic = self.cosmic();
31
32 match self.layer {
33 cosmic_theme::Layer::Background => crate::widget::card::style::Style {
34 card_1: Background::Color(cosmic.background.component.hover.into()),
35 card_2: Background::Color(cosmic.background.component.pressed.into()),
36 },
37 cosmic_theme::Layer::Primary => crate::widget::card::style::Style {
38 card_1: Background::Color(cosmic.primary.component.hover.into()),
39 card_2: Background::Color(cosmic.primary.component.pressed.into()),
40 },
41 cosmic_theme::Layer::Secondary => crate::widget::card::style::Style {
42 card_1: Background::Color(cosmic.secondary.component.hover.into()),
43 card_2: Background::Color(cosmic.secondary.component.pressed.into()),
44 },
45 }
46 }
47}