From bd6f8ff9bfe0b14819dba640fc0f15224a1d7106 Mon Sep 17 00:00:00 2001 From: unspeaker Date: Tue, 23 Jul 2024 23:28:11 +0300 Subject: [PATCH] fix background of last arranger row --- src/devices/arranger/arr_draw_v.rs | 16 ++++++++++------ src/view/theme.rs | 6 ++++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/devices/arranger/arr_draw_v.rs b/src/devices/arranger/arr_draw_v.rs index 2687cce8..8ff8fe89 100644 --- a/src/devices/arranger/arr_draw_v.rs +++ b/src/devices/arranger/arr_draw_v.rs @@ -41,7 +41,7 @@ pub fn draw ( fn column_separators <'a> (offset: u16, cols: &'a [(usize, usize)]) -> impl Render + 'a { move |buf: &mut Buffer, area: Rect|{ - let style = Some(Style::default().fg(Color::Rgb(0,0,0))); + let style = Some(Style::default().fg(Nord::SEPARATOR)); for (_, x) in cols.iter() { let x = offset + area.x + *x as u16 - 1; for y in area.y..area.height+area.y { @@ -62,7 +62,7 @@ fn row_separators <'a> (rows: &'a [(usize, usize)]) -> impl Render + 'a { for x in area.x..area.width+area.y-2 { let cell = buf.get_mut(x, y); cell.modifier = Modifier::UNDERLINED; - cell.underline_color = Color::Rgb(0, 0, 0); + cell.underline_color = Nord::SEPARATOR; } } Ok(area) @@ -158,7 +158,7 @@ pub fn scene_rows <'a> ( offset: u16, ) -> impl Render + 'a { move |buf: &mut Buffer, area: Rect| { - let black = Some(Style::default().fg(Color::Rgb(0, 0, 0))); + let black = Some(Style::default().fg(Nord::SEPARATOR)); let Rect { mut y, height, .. } = area; for (_, x) in track_cols.iter() { let x = *x as u16; @@ -173,8 +173,12 @@ pub fn scene_rows <'a> ( break } let h = 1.max((pulses / 96) as u16); - let area = Rect { x: area.x, y, width: area.width, height: h.min(area.height - y) }; - scene_row(state, buf, area, scene, track_cols, offset)?; + scene_row(state, buf, Rect { + x: area.x, + y, + width: area.width, + height: h,//.min(area.height - y) + }, scene, track_cols, offset)?; y = y + h } Ok(area) @@ -212,7 +216,7 @@ fn scene_row ( y, width: *w as u16, height: area.height, - }, Color::Rgb(60,100,50)); + }, Nord::PLAYING); } } } diff --git a/src/view/theme.rs b/src/view/theme.rs index a7afdd39..33e0a271 100644 --- a/src/view/theme.rs +++ b/src/view/theme.rs @@ -10,6 +10,9 @@ pub trait Theme { const YELLOW: Color; const GREEN: Color; + const PLAYING: Color; + const SEPARATOR: Color; + fn bg_hier (focused: bool, entered: bool) -> Color { if focused && entered { Self::BG3 @@ -62,4 +65,7 @@ impl Theme for Nord { const RED: Color = Color::Rgb(191, 97, 106); const YELLOW: Color = Color::Rgb(235, 203, 139); const GREEN: Color = Color::Rgb(163, 190, 140); + + const PLAYING: Color = Color::Rgb(60, 100, 50); + const SEPARATOR: Color = Color::Rgb(0, 0, 0); }