2020-01-01 14:16:10 +01:00
|
|
|
//! Decorate content and apply alignment.
|
|
|
|
|
use iced_core::{Background, Color};
|
|
|
|
|
|
|
|
|
|
/// The appearance of a container.
|
|
|
|
|
#[derive(Debug, Clone, Copy)]
|
2022-06-07 04:11:24 +02:00
|
|
|
pub struct Appearance {
|
2020-01-01 14:16:10 +01:00
|
|
|
pub text_color: Option<Color>,
|
|
|
|
|
pub background: Option<Background>,
|
2020-11-23 00:31:50 +01:00
|
|
|
pub border_radius: f32,
|
|
|
|
|
pub border_width: f32,
|
2020-01-05 18:38:03 +01:00
|
|
|
pub border_color: Color,
|
2020-01-01 14:16:10 +01:00
|
|
|
}
|
|
|
|
|
|
2022-06-07 04:11:24 +02:00
|
|
|
impl std::default::Default for Appearance {
|
2020-01-05 19:34:38 +01:00
|
|
|
fn default() -> Self {
|
|
|
|
|
Self {
|
|
|
|
|
text_color: None,
|
|
|
|
|
background: None,
|
2020-11-23 00:31:50 +01:00
|
|
|
border_radius: 0.0,
|
|
|
|
|
border_width: 0.0,
|
2020-01-05 19:34:38 +01:00
|
|
|
border_color: Color::TRANSPARENT,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-07 04:11:24 +02:00
|
|
|
/// A set of rules that dictate the [`Appearance`] of a container.
|
2020-01-01 14:16:10 +01:00
|
|
|
pub trait StyleSheet {
|
2022-06-07 04:11:24 +02:00
|
|
|
type Style: Default + Copy;
|
2021-10-31 17:02:59 +07:00
|
|
|
|
2022-06-07 04:11:24 +02:00
|
|
|
/// Produces the [`Appearance`] of a container.
|
|
|
|
|
fn appearance(&self, style: Self::Style) -> Appearance;
|
2020-01-01 14:16:10 +01:00
|
|
|
}
|