use crossterm::style::Attribute;
use crossterm::style::Color;
#[derive(Clone)]
pub struct Style {
foreground: Option<Color>,
background: Option<Color>,
attributes: Vec<Attribute>,
}
impl Default for Style {
fn default() -> Self {
Style {
foreground: None,
background: None,
attributes: vec![],
}
}
}
impl Style {
pub fn set_foreground_color(&mut self, color: Color) {
self.foreground = Some(color);
}
pub fn foreground_color(&self) -> &Option<Color> {
&self.foreground
}
pub fn set_background_color(&mut self, color: Color) {
self.background = Some(color);
}
pub fn background_color(&self) -> &Option<Color> {
&self.background
}
pub fn attributes(&self) -> &Vec<Attribute> {
&self.attributes
}
pub fn add_attribute(&mut self, attribute: Attribute) {
self.attributes.push(attribute);
}
pub fn clear_attributes(&mut self) {
self.attributes.clear();
}
}