iced-yoda/style/src/container.rs

51 lines
1.1 KiB
Rust
Raw Normal View History

//! Decorate content and apply alignment.
use iced_core::{Background, Color};
/// The appearance of a container.
#[derive(Debug, Clone, Copy)]
pub struct Style {
pub text_color: Option<Color>,
pub background: Option<Background>,
pub border_radius: f32,
pub border_width: f32,
2020-01-05 18:38:03 +01:00
pub border_color: Color,
}
impl std::default::Default for Style {
fn default() -> Self {
Self {
text_color: None,
background: None,
border_radius: 0.0,
border_width: 0.0,
border_color: Color::TRANSPARENT,
}
}
}
/// A set of rules that dictate the style of a container.
pub trait StyleSheet {
/// Produces the style of a container.
2020-01-01 18:26:49 +01:00
fn style(&self) -> Style;
}
struct Default;
impl StyleSheet for Default {
fn style(&self) -> Style {
Style {
text_color: None,
background: None,
border_radius: 0.0,
border_width: 0.0,
2020-01-05 18:38:03 +01:00
border_color: Color::TRANSPARENT,
}
}
}
impl std::default::Default for &'static dyn StyleSheet {
fn default() -> Self {
&Default
}
}