use crate::*; pub trait TuiStyle { fn fg > (color: Color, w: R) -> Foreground { Foreground(color, w) } fn bg > (color: Color, w: R) -> Background { Background(color, w) } fn fg_bg > (fg: Color, bg: Color, w: R) -> Background> { Background(bg, Foreground(fg, w)) } fn modify > (enable: bool, modifier: Modifier, w: R) -> Modify { Modify(enable, modifier, w) } fn bold > (enable: bool, w: R) -> Modify { Self::modify(enable, Modifier::BOLD, w) } fn border , S: BorderStyle> (enable: bool, style: S, w: R) -> Bordered { Bordered(enable, style, w) } } impl TuiStyle for Tui {} pub struct Foreground>(pub Color, pub R); impl> Content for Foreground { fn content (&self) -> impl Render { &self.1 } fn render (&self, to: &mut TuiOut) { to.fill_fg(to.area(), self.0); self.1.render(to) } } pub struct Background>(pub Color, pub R); impl> Content for Background { fn content (&self) -> impl Render { &self.1 } fn render (&self, to: &mut TuiOut) { to.fill_bg(to.area(), self.0); self.1.render(to) } } pub struct Modify>(pub bool, pub Modifier, pub R); impl> Content for Modify { fn content (&self) -> impl Render { &self.2 } fn render (&self, to: &mut TuiOut) { to.fill_mod(to.area(), self.0, self.1); self.2.render(to) } } pub struct Styled>(pub Option