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::{Background, Color, border::Radius};
7
8/// The appearance of a menu.
9#[derive(Debug, Clone, Copy)]
10pub struct Appearance {
11    /// Menu text color
12    pub text_color: Color,
13    /// Menu background
14    pub background: Background,
15    /// Menu border width
16    pub border_width: f32,
17    /// Menu border radius
18    pub border_radius: Radius,
19    /// Menu border color
20    pub border_color: Color,
21    /// Text color when hovered
22    pub hovered_text_color: Color,
23    /// Background when hovered
24    pub hovered_background: Background,
25    /// Text color when selected
26    pub selected_text_color: Color,
27    /// Background when selected
28    pub selected_background: Background,
29    /// Description text color
30    pub description_color: Color,
31}
32
33/// The style sheet of a menu.
34pub trait StyleSheet {
35    /// The supported style of the [`StyleSheet`].
36    type Style: Default + Clone;
37
38    /// Produces the [`Appearance`] of a menu.
39    fn appearance(&self, style: &Self::Style) -> Appearance;
40}