cosmic/widget/card/
style.rs1use 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(
35 cosmic.background(self.transparent).component.hover.into(),
36 ),
37 card_2: Background::Color(
38 cosmic.background(self.transparent).component.pressed.into(),
39 ),
40 },
41 cosmic_theme::Layer::Primary => crate::widget::card::style::Style {
42 card_1: Background::Color(cosmic.primary(self.transparent).component.hover.into()),
43 card_2: Background::Color(
44 cosmic.primary(self.transparent).component.pressed.into(),
45 ),
46 },
47 cosmic_theme::Layer::Secondary => crate::widget::card::style::Style {
48 card_1: Background::Color(
49 cosmic.secondary(self.transparent).component.hover.into(),
50 ),
51 card_2: Background::Color(
52 cosmic.secondary(self.transparent).component.pressed.into(),
53 ),
54 },
55 }
56 }
57}