From 31e4a2bb423526e3cea49e4c7e19ae0faf5ae1ae Mon Sep 17 00:00:00 2001 From: Erik Kundt Date: Mon, 17 Jun 2024 12:04:01 +0200 Subject: [PATCH] lib: Use container focus for table highlighting --- src/ui/theme.rs | 8 ++++++-- src/ui/widget/list.rs | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/ui/theme.rs b/src/ui/theme.rs index 9b38b66e..980e5c4e 100644 --- a/src/ui/theme.rs +++ b/src/ui/theme.rs @@ -49,7 +49,11 @@ pub mod style { } } - pub fn highlight() -> Style { - cyan().not_dim().reversed() + pub fn highlight(focus: bool) -> Style { + if focus { + cyan().not_dim().reversed() + } else { + cyan().dim().reversed() + } } } diff --git a/src/ui/widget/list.rs b/src/ui/widget/list.rs index ebca9a35..edad9174 100644 --- a/src/ui/widget/list.rs +++ b/src/ui/widget/list.rs @@ -249,7 +249,7 @@ where .rows(rows) .widths(widths) .column_spacing(1) - .highlight_style(style::highlight()); + .highlight_style(style::highlight(render.focus)); frame.render_stateful_widget(rows, render.area, &mut self.state); } else {