Phrase -> Clip in all remaining places

This commit is contained in:
🪞👃🪞 2025-01-11 22:50:57 +01:00
parent 06b643e2b1
commit bb52555183
15 changed files with 916 additions and 936 deletions

View file

@ -80,3 +80,44 @@ impl Content<TuiOut> for RepeatH<'_> {
}
}
}
/// A phat line
pub fn phat_lo (fg: Color, bg: Color) -> impl Content<TuiOut> {
Fixed::y(1, Tui::fg_bg(fg, bg, RepeatH(&"")))
}
/// A phat line
pub fn phat_hi (fg: Color, bg: Color) -> impl Content<TuiOut> {
Fixed::y(1, Tui::fg_bg(fg, bg, RepeatH(&"")))
}
/// A cell that is 3-row on its own, but stacks, giving (N+1)*2 rows per N cells.
pub fn phat_cell <T: Content<TuiOut>> (
color: ItemPalette, last: ItemPalette, field: T
) -> impl Content<TuiOut> {
Bsp::s(phat_lo(color.base.rgb, last.base.rgb),
Bsp::n(phat_hi(color.base.rgb, last.base.rgb),
Fixed::y(1, Fill::x(Tui::fg_bg(color.lightest.rgb, color.base.rgb, field))),
)
)
}
pub fn phat_cell_3 <T: Content<TuiOut>> (
field: T, top: Color, middle: Color, bottom: Color
) -> impl Content<TuiOut> {
Bsp::s(phat_lo(middle, top),
Bsp::n(phat_hi(middle, bottom),
Fill::y(Fill::x(Tui::bg(middle, field))),
)
)
}
pub fn phat_sel_3 <T: Content<TuiOut>> (
selected: bool, field_1: T, field_2: T, top: Option<Color>, middle: Color, bottom: Color
) -> impl Content<TuiOut> {
let border = Style::default().fg(Color::Rgb(255,255,255)).bg(middle);
Either(selected,
Tui::bg(middle, Outer(border).enclose(Align::w(Bsp::s("", Bsp::n("", Fill::y(field_1)))))),
Bsp::s(Fixed::y(1, top.map(|top|phat_lo(middle, top))),
Bsp::n(Fixed::y(1, phat_hi(middle, bottom)),
Fill::xy(Tui::bg(middle, field_2)),
)
)
)
}