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
|
use iced_widget::core::{Background, Border, border};
use iced_widget::overlay::menu::{Catalog, Style, StyleFn};
use super::Theme;
use crate::utils::{HOVERED_LAYER_OPACITY, mix};
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<'_>) -> Style {
class(self)
}
}
pub fn default(theme: &Theme) -> Style {
let colors = theme.colorscheme.surface;
Style {
border: Border {
radius: border::bottom(4),
..Default::default()
},
background: Background::Color(colors.surface_container.base),
text_color: colors.on_surface,
selected_background: Background::Color(mix(
colors.surface_container.base,
colors.on_surface,
HOVERED_LAYER_OPACITY,
)),
selected_text_color: colors.on_surface,
}
}
|