iced_aw/style/
context_menu.rs1use super::{Status, StyleFn};
5use iced_core::{Background, Color, Theme};
6
7#[derive(Clone, Copy, Debug)]
9pub struct Style {
10 pub background: Background,
14}
15
16impl Default for Style {
17 fn default() -> Self {
18 Self {
19 background: Background::Color([0.87, 0.87, 0.87, 0.30].into()),
20 }
21 }
22}
23
24pub trait Catalog {
26 type Class<'a>;
28
29 fn default<'a>() -> Self::Class<'a>;
31
32 fn style(&self, class: &Self::Class<'_>, status: Status) -> Style;
34}
35
36impl Catalog for Theme {
37 type Class<'a> = StyleFn<'a, Self, Style>;
38
39 fn default<'a>() -> Self::Class<'a> {
40 Box::new(primary)
41 }
42
43 fn style(&self, class: &Self::Class<'_>, status: Status) -> Style {
44 class(self, status)
45 }
46}
47
48#[must_use]
50pub fn primary(theme: &Theme, _status: Status) -> Style {
51 let palette = theme.extended_palette();
52
53 Style {
54 background: Background::Color(Color {
55 a: 0f32,
56 ..palette.background.base.color
57 }),
58 }
59}