impl TuiTheme on Tui; need to to reduce number of ItemPalette invocations

This commit is contained in:
🪞👃🪞 2025-01-19 22:09:37 +01:00
parent 9d250daa04
commit cfa3cad5cb
9 changed files with 157 additions and 177 deletions

View file

@ -842,12 +842,12 @@ impl Sampler {
let note_lo = editor.note_lo().load(Relaxed);
let note_pt = editor.note_pos();
let note_hi = editor.note_hi();
Outer(true, Style::default().fg(TuiTheme::g(96))).enclose(Map::new(move||(note_lo..=note_hi).rev(), move|note, i| {
Outer(true, Style::default().fg(Tui::g(96))).enclose(Map::new(move||(note_lo..=note_hi).rev(), move|note, i| {
let offset = |a|Push::y(i as u16, Align::n(Fixed::y(1, Fill::x(a))));
let mut bg = if note == note_pt { TuiTheme::g(64) } else { Color::Reset };
let mut fg = TuiTheme::g(160);
let mut bg = if note == note_pt { Tui::g(64) } else { Color::Reset };
let mut fg = Tui::g(160);
if self.mapped[note].is_some() {
fg = TuiTheme::g(224);
fg = Tui::g(224);
bg = Color::Rgb(0, if note == note_pt { 96 } else { 64 }, 0);
}
if let Some((index, _)) = self.recording {
@ -929,7 +929,7 @@ impl Sampler {
})
}
pub fn status (&self, index: usize) -> impl Content<TuiOut> {
Tui::bold(true, Tui::fg(TuiTheme::g(224), self.mapped[index].as_ref().map(|sample|format!(
Tui::bold(true, Tui::fg(Tui::g(224), self.mapped[index].as_ref().map(|sample|format!(
"Sample {}-{}",
sample.read().unwrap().start,
sample.read().unwrap().end,