From 4fe255e7d26757a7c2c96c61d068c76a2a678e8b Mon Sep 17 00:00:00 2001 From: John Doty Date: Tue, 13 Aug 2024 10:52:20 -0700 Subject: [PATCH] Fix colors in the help box When the lines of the help box overlap with disabled or error'd ports you might notice that those lines are dark grey or red. That's surprising! The bug is that Style::default() means "don't change anything", just continue being whatever color the current cell is, which is deeply surprising. What we really want here is `Style::reset()`, which means "reset the colors to whatever the terminal would show by default." --- src/client/ui.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/client/ui.rs b/src/client/ui.rs index 4a3d2df..ae3fcd3 100644 --- a/src/client/ui.rs +++ b/src/client/ui.rs @@ -323,10 +323,10 @@ impl UI { } fn render_ports(&mut self, frame: &mut Frame, size: Rect) { - let enabled_port_style = Style::default(); - let disabled_port_style = Style::default().fg(Color::DarkGray); + let enabled_port_style = Style::reset(); + let disabled_port_style = Style::reset().fg(Color::DarkGray); let broken_port_style = - Style::default().fg(Color::Red).add_modifier(Modifier::DIM); + Style::reset().fg(Color::Red).add_modifier(Modifier::DIM); let mut rows = Vec::new(); let ports = self.get_ui_ports(); @@ -399,7 +399,8 @@ impl UI { ]; let keybindings = Table::new(keybindings, keybindings_widths) .column_spacing(1) - .block(Block::default().title("Keys").borders(Borders::ALL)); + .block(Block::default().title("Keys").borders(Borders::ALL)) + .style(Style::reset()); // keybindings frame.render_widget(keybindings, inner_area);