diff --git a/crates/tek_core/src/tui.rs b/crates/tek_core/src/tui.rs index 6ac70c4f..684742e3 100644 --- a/crates/tek_core/src/tui.rs +++ b/crates/tek_core/src/tui.rs @@ -258,6 +258,13 @@ impl TuiOutput { ) { buffer_update(&mut self.buffer, area, callback); } + pub fn fill_bold (&mut self, area: [u16;4], on: bool) { + if on { + self.buffer_update(area, &|cell,_,_|cell.modifier.insert(Modifier::BOLD)) + } else { + self.buffer_update(area, &|cell,_,_|cell.modifier.remove(Modifier::BOLD)) + } + } pub fn fill_bg (&mut self, area: [u16;4], color: Color) { self.buffer_update(area, &|cell,_,_|{cell.set_bg(color);}) } @@ -428,12 +435,25 @@ pub trait TuiStyle: Widget + Sized { fn bg (self, color: Color) -> impl Widget { Layers::new(move |add|{ add(&Background(color))?; add(&self) }) } + fn bold (self, on: bool) -> impl Widget { + Layers::new(move |add|{ add(&Bold(on))?; add(&self) }) + } fn border (self, style: impl BorderStyle) -> impl Widget { Bordered(style, self) } } impl> TuiStyle for W {} +pub struct Bold(pub bool); +impl Widget for Bold { + type Engine = Tui; + fn layout (&self, _: [u16;2]) -> Perhaps<[u16;2]> { + Ok(Some([0,0])) + } + fn render (&self, to: &mut TuiOutput) -> Usually<()> { + Ok(to.fill_bold(to.area(), self.0)) + } +} pub struct Foreground(pub Color); impl Widget for Foreground { type Engine = Tui; diff --git a/crates/tek_sequencer/src/arranger_tui.rs b/crates/tek_sequencer/src/arranger_tui.rs index be99aff5..6311c32d 100644 --- a/crates/tek_sequencer/src/arranger_tui.rs +++ b/crates/tek_sequencer/src/arranger_tui.rs @@ -34,7 +34,9 @@ impl Content for ArrangerStatusBar { Self::PhrasePool => "Phrases", Self::PhraseEditor => "Sequencer", }; - TuiStyle::bg(format!(" {label} "), Color::Rgb(150, 160, 90)).fg(Color::Rgb(0, 0, 0)) + TuiStyle::bg(format!(" {label} "), Color::Rgb(150, 160, 90)) + .fg(Color::Rgb(0, 0, 0)) + .bold(true) } } impl Content for Arrangement {