#[warn(dead_code)]
use crate::border::BorderStyle;
use crate::color::Color;
use crate::decoration::Decoration;
#[derive(Clone, Debug)]
pub struct Style {
pub fg: Option<Color>, pub bg: Option<Color>, pub decoration: Option<Vec<Decoration>>, pub padding: Option<u8>, pub padding_top: Option<u8>, pub padding_bottom: Option<u8>, pub padding_left: Option<u8>, pub padding_right: Option<u8>, pub margin: Option<u8>, pub margin_top: Option<u8>, pub margin_bottom: Option<u8>, pub margin_left: Option<u8>, pub margin_right: Option<u8>, pub border_color: Option<Color>, pub border_style: Option<BorderStyle>, }
impl Style {
pub fn new() -> Self {
Style {
fg: None,
bg: None,
decoration: None,
padding: None,
margin: None,
margin_top: None,
margin_bottom: None,
margin_left: None,
margin_right: None,
border_color: None,
border_style: None,
padding_top: None,
padding_bottom: None,
padding_left: None,
padding_right: None,
}
}
pub fn fg(mut self, color: Color) -> Self {
self.fg = Some(color);
self
}
pub fn bg(mut self, color: Color) -> Self {
self.bg = Some(color);
self
}
pub fn decoration(mut self, deco: Vec<Decoration>) -> Self {
self.decoration = Some(deco);
self
}
pub fn padding(mut self, pad: u8) -> Self {
self.padding = Some(pad);
self
}
pub fn padding_top(mut self, pad: u8) -> Self {
self.padding_top = Some(pad);
self
}
pub fn padding_bottom(mut self, pad: u8) -> Self {
self.padding_bottom = Some(pad);
self
}
pub fn padding_left(mut self, pad: u8) -> Self {
self.padding_left = Some(pad);
self
}
pub fn padding_right(mut self, pad: u8) -> Self {
self.padding_right = Some(pad);
self
}
pub fn margin(mut self, margin: u8) -> Self {
self.margin = Some(margin);
self
}
pub fn margin_top(mut self, margin: u8) -> Self {
self.margin_top = Some(margin);
self
}
pub fn margin_bottom(mut self, margin: u8) -> Self {
self.margin_bottom = Some(margin);
self
}
pub fn margin_left(mut self, margin: u8) -> Self {
self.margin_left = Some(margin);
self
}
pub fn margin_right(mut self, margin: u8) -> Self {
self.margin_right = Some(margin);
self
}
pub fn border_color(mut self, color: Color) -> Self {
self.border_color = Some(color);
self
}
pub fn border_style(mut self, style: BorderStyle) -> Self {
self.border_style = Some(style);
self
}
}
impl Default for Style {
fn default() -> Self {
Style::new()
}
}