From 68f4ed46b1846e27c03f23d0b98e3ce89dc497b8 Mon Sep 17 00:00:00 2001 From: pml68 Date: Sun, 13 Apr 2025 03:31:36 +0200 Subject: feat(material_theme): implement `pick_list::Catalog` --- material_theme/src/menu.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'material_theme/src/menu.rs') 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, } } -- cgit v1.2.3