use super::TerminalStyle; #[derive(Clone, Copy)] pub struct TerminalAtom { pub c: Option, pub style: TerminalStyle } impl TerminalAtom { pub fn new(c: char, style: TerminalStyle) -> Self { TerminalAtom { c: Some(c), style } } pub fn new_bg(bg_color: (u8, u8, u8)) -> Self { TerminalAtom { c: None, style: TerminalStyle::bg_color(bg_color) } } pub fn add_style_front(mut self, style: TerminalStyle) -> Self { self.style = self.style.add(style); self } pub fn add_style_back(mut self, style: TerminalStyle) -> Self { self.style = style.add(self.style); self } } impl From for TerminalAtom { fn from(c: char) -> Self { TerminalAtom { c: Some(c), style: TerminalStyle::default() } } } impl From> for TerminalAtom { fn from(c: Option) -> Self { TerminalAtom { c, style: TerminalStyle::default() } } } impl From<&char> for TerminalAtom { fn from(c: &char) -> Self { TerminalAtom { c: Some(*c), style: TerminalStyle::default() } } }