summaryrefslogtreecommitdiff
path: root/material_theme/src/menu.rs
diff options
context:
space:
mode:
authorpml68 <contact@pml68.dev>2025-04-13 03:31:36 +0200
committerpml68 <contact@pml68.dev>2025-04-15 23:52:40 +0200
commit68f4ed46b1846e27c03f23d0b98e3ce89dc497b8 (patch)
tree11a284c74966045a2f99fb7e62845e295ede54ec /material_theme/src/menu.rs
parentfeat(material_theme): add disabled scrollable `Style`s (diff)
downloadiced-builder-68f4ed46b1846e27c03f23d0b98e3ce89dc497b8.tar.gz
feat(material_theme): implement `pick_list::Catalog`
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,
}
}