1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
use iced_widget::core::{Background, border};
use iced_widget::pick_list::{Catalog, Status, Style, StyleFn};
use super::Theme;
impl Catalog for Theme {
type Class<'a> = StyleFn<'a, Self>;
fn default<'a>() -> <Self as Catalog>::Class<'a> {
Box::new(default)
}
fn style(
&self,
class: &<Self as Catalog>::Class<'_>,
status: Status,
) -> Style {
class(self, status)
}
}
pub fn default(theme: &Theme, status: Status) -> Style {
let surface = theme.colors().surface;
let active = Style {
text_color: surface.text,
placeholder_color: surface.text_variant,
handle_color: surface.text_variant,
background: Background::Color(surface.container.highest),
border: border::rounded(4),
};
match status {
Status::Active => active,
Status::Hovered => Style {
background: Background::Color(surface.container.highest),
..active
},
Status::Opened { .. } => Style {
background: Background::Color(surface.container.highest),
border: border::rounded(4),
..active
},
}
}
|