use crate::*; pub trait TuiStyle { fn fg > (color: Color, w: W) -> Foreground { Foreground(color, w) } fn bg > (color: Color, w: W) -> Background { Background(color, w) } fn fg_bg > (fg: Color, bg: Color, w: W) -> Background> { Background(bg, Foreground(fg, w)) } fn bold > (on: bool, w: W) -> Bold { Bold(on, w) } fn border , S: BorderStyle> (style: S, w: W) -> Bordered { Bordered(style, w) } } impl TuiStyle for Tui {} pub struct Bold>(pub bool, W); impl> Content for Bold { fn content (&self) -> impl Render { &self.1 } fn render (&self, to: &mut TuiOut) { to.fill_bold(to.area(), self.0); self.1.render(to) } } pub struct Foreground>(pub Color, W); 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, W); 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 Styled>(pub Option