summaryrefslogtreecommitdiff
path: root/material_theme/src/menu.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--material_theme/src/menu.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/material_theme/src/menu.rs b/material_theme/src/menu.rs
index d1bebec..9f43c72 100644
--- a/material_theme/src/menu.rs
+++ b/material_theme/src/menu.rs
@@ -2,6 +2,7 @@ use iced_widget::core::{Background, 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>;
@@ -16,14 +17,17 @@ impl Catalog for Theme {
}
pub fn default(theme: &Theme) -> Style {
- let surface = theme.colorscheme.surface;
- let secondary = theme.colorscheme.secondary;
+ let colors = theme.colorscheme.surface;
Style {
border: border::rounded(4),
- background: Background::Color(surface.surface_container.base),
- text_color: surface.on_surface,
- selected_background: Background::Color(secondary.secondary_container),
- selected_text_color: secondary.on_secondary_container,
+ 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,
}
}