mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-06 11:46:42 +01:00
tui_phat: export LO and HI chars
This commit is contained in:
parent
91dfed1077
commit
b5fbd14f91
1 changed files with 9 additions and 3 deletions
|
|
@ -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)))
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue