Skip to main content

cosmic/widget/dropdown/menu/
appearance.rs

1// Copyright 2023 System76 <info@system76.com>
2// Copyright 2019 Héctor Ramón, Iced contributors
3// SPDX-License-Identifier: MPL-2.0 AND MIT
4
5//! Change the appearance of menus.
6use iced_core::border::Radius;
7use iced_core::{Background, Color};
8
9/// The appearance of a menu.
10#[derive(Debug, Clone, Copy)]
11pub struct Appearance {
12    /// Menu text color
13    pub text_color: Color,
14    /// Menu background
15    pub background: Background,
16    /// Menu border width
17    pub border_width: f32,
18    /// Menu border radius
19    pub border_radius: Radius,
20    /// Menu border color
21    pub border_color: Color,
22    /// Text color when hovered
23    pub hovered_text_color: Color,
24    /// Background when hovered
25    pub hovered_background: Background,
26    /// Text color when selected
27    pub selected_text_color: Color,
28    /// Background when selected
29    pub selected_background: Background,
30    /// Description text color
31    pub description_color: Color,
32}
33
34/// The style sheet of a menu.
35pub trait StyleSheet {
36    /// The supported style of the [`StyleSheet`].
37    type Style: Default + Clone;
38
39    /// Produces the [`Appearance`] of a menu.
40    fn appearance(&self, style: &Self::Style) -> Appearance;
41}