iced-yoda/style/src/menu.rs

31 lines
956 B
Rust
Raw Normal View History

2022-11-10 01:10:28 +01:00
//! Change the appearance of menus.
use iced_core::{Background, Color};
/// The appearance of a menu.
#[derive(Debug, Clone, Copy)]
pub struct Appearance {
2022-11-10 01:10:28 +01:00
/// The text [`Color`] of the menu.
pub text_color: Color,
2022-11-10 01:10:28 +01:00
/// The [`Background`] of the menu.
pub background: Background,
2022-11-10 01:10:28 +01:00
/// The border width of the menu.
pub border_width: f32,
2022-11-10 01:10:28 +01:00
/// The border radius of the menu.
pub border_radius: f32,
2022-11-10 01:10:28 +01:00
/// The border [`Color`] of the menu.
pub border_color: Color,
2022-11-10 01:10:28 +01:00
/// The text [`Color`] of a selected option in the menu.
pub selected_text_color: Color,
2022-11-10 01:10:28 +01:00
/// The background [`Color`] of a selected option in the menu.
pub selected_background: Background,
}
2022-11-10 01:10:28 +01:00
/// The style sheet of a menu.
pub trait StyleSheet {
2022-11-10 01:10:28 +01:00
/// The supported style of the [`StyleSheet`].
type Style: Default + Clone;
2022-11-10 01:10:28 +01:00
/// Produces the [`Appearance`] of a menu.
fn appearance(&self, style: &Self::Style) -> Appearance;
}