tui_phat: export LO and HI chars

This commit is contained in:
🪞👃🪞 2025-04-25 13:58:19 +03:00
parent 91dfed1077
commit b5fbd14f91

View file

@ -9,13 +9,15 @@ pub struct Phat<T> {
pub colors: [Color;4], pub colors: [Color;4],
} }
impl<T> Phat<T> { impl<T> Phat<T> {
pub const LO: &'static str = "";
pub const HI: &'static str = "";
/// A phat line /// A phat line
pub fn lo (fg: Color, bg: Color) -> impl Content<TuiOut> { pub fn lo (fg: Color, bg: Color) -> impl Content<TuiOut> {
Fixed::y(1, Tui::fg_bg(fg, bg, RepeatH(&""))) Fixed::y(1, Tui::fg_bg(fg, bg, RepeatH(Self::LO)))
} }
/// A phat line /// A phat line
pub fn hi (fg: Color, bg: Color) -> impl Content<TuiOut> { pub fn hi (fg: Color, bg: Color) -> impl Content<TuiOut> {
Fixed::y(1, Tui::fg_bg(fg, bg, RepeatH(&""))) Fixed::y(1, Tui::fg_bg(fg, bg, RepeatH(Self::HI)))
} }
} }
impl<T: Content<TuiOut>> Content<TuiOut> for Phat<T> { impl<T: Content<TuiOut>> Content<TuiOut> for Phat<T> {
@ -24,6 +26,10 @@ impl<T: Content<TuiOut>> Content<TuiOut> for Phat<T> {
let top = Fixed::y(1, Self::lo(bg, hi)); let top = Fixed::y(1, Self::lo(bg, hi));
let low = Fixed::y(1, Self::hi(bg, lo)); let low = Fixed::y(1, Self::hi(bg, lo));
let content = Tui::fg_bg(fg, bg, &self.content); let content = Tui::fg_bg(fg, bg, &self.content);
Min::xy(self.width, self.height, Bsp::s(top, Bsp::n(low, Fill::xy(content)))) Min::xy(
self.width,
self.height,
Bsp::s(top, Bsp::n(low, Fill::xy(content)))
)
} }
} }