summaryrefslogtreecommitdiffstats
path: root/style/src/menu.rs
blob: dbf19dae3771f5da5a1348e7561760696b097355 (plain) (blame)
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
//! Change the appearance of menus.
use iced_core::{Background, BorderRadius, Color};

/// The appearance of a menu.
#[derive(Debug, Clone, Copy)]
pub struct Appearance {
    /// The text [`Color`] of the menu.
    pub text_color: Color,
    /// The [`Background`] of the menu.
    pub background: Background,
    /// The border width of the menu.
    pub border_width: f32,
    /// The border radius of the menu.
    pub border_radius: BorderRadius,
    /// The border [`Color`] of the menu.
    pub border_color: Color,
    /// The text [`Color`] of a selected option in the menu.
    pub selected_text_color: Color,
    /// The background [`Color`] of a selected option in the menu.
    pub selected_background: Background,
}

/// The style sheet of a menu.
pub trait StyleSheet {
    /// The supported style of the [`StyleSheet`].
    type Style: Default + Clone;

    /// Produces the [`Appearance`] of a menu.
    fn appearance(&self, style: &Self::Style) -> Appearance;
}