use crate::*; pub struct OctaveVertical { on: [bool; 12], colors: [Color; 3] } impl Default for OctaveVertical { fn default () -> Self { Self { on: [false; 12], colors: [Rgb(255,255,255), Rgb(0,0,0), Rgb(255,0,0)] } } } impl OctaveVertical { fn color (&self, pitch: usize) -> Color { let pitch = pitch % 12; self.colors[if self.on[pitch] { 2 } else { match pitch { 0 | 2 | 4 | 5 | 6 | 8 | 10 => 0, _ => 1 } }] } } impl Content for OctaveVertical { fn content (&self) -> impl Render { row!( Tui::fg_bg(self.color(0), self.color(1), "▙"), Tui::fg_bg(self.color(2), self.color(3), "▙"), Tui::fg_bg(self.color(4), self.color(5), "▌"), Tui::fg_bg(self.color(6), self.color(7), "▟"), Tui::fg_bg(self.color(8), self.color(9), "▟"), Tui::fg_bg(self.color(10), self.color(11), "▟"), ) } }