mode indicator

This commit is contained in:
🪞👃🪞 2025-03-23 00:01:22 +02:00
parent acc2ce0ca2
commit 26d05e544b
3 changed files with 25 additions and 11 deletions

View file

@ -5,12 +5,26 @@ pub(crate) use pad::PadStr;
mod status; pub use self::status::*;
mod table; pub use self::table::*;
impl Taggart {
pub(crate) const FG_BROWSE: Color = Color::Rgb(255, 192, 0);
pub(crate) const BG_BROWSE: Color = Color::Rgb(0, 0, 0);
pub(crate) const BG_EDIT: Color = Color::Rgb(48, 128, 0);
pub(crate) const FG_EDIT: Color = Color::Rgb(255, 255, 255);
}
impl Content<TuiOut> for Taggart {
fn content (&self) -> impl Render<TuiOut> {
let sizer = Fill::xy(&self.size);
let size = format!("{}x{}", self.size.w(), self.size.h());
let size_bar = status_bar(Align::e(size));
let titlebar = status_bar(Align::w(self.columns.header()));
let size_bar = status_bar(Fill::x(Bsp::a(
Fill::x(Align::w(Tui::bold(true, if self.editing.is_some() {
Tui::bg(Self::BG_EDIT, Tui::fg(Self::FG_EDIT, " EDIT "))
} else {
Tui::bg(Self::BG_BROWSE, Tui::fg(Self::FG_BROWSE, " BROWSE "))
}))),
Fill::x(Align::e(size)),
)));
Bsp::n(size_bar, Bsp::s(titlebar, Bsp::b(sizer, Fill::xy(TreeTable(self)))))
}
}