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."
This commit is contained in:
John Doty 2024-08-13 10:52:20 -07:00
parent b381f71692
commit 4fe255e7d2

View file

@ -323,10 +323,10 @@ impl UI {
} }
fn render_ports(&mut self, frame: &mut Frame, size: Rect) { fn render_ports(&mut self, frame: &mut Frame, size: Rect) {
let enabled_port_style = Style::default(); let enabled_port_style = Style::reset();
let disabled_port_style = Style::default().fg(Color::DarkGray); let disabled_port_style = Style::reset().fg(Color::DarkGray);
let broken_port_style = 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 mut rows = Vec::new();
let ports = self.get_ui_ports(); let ports = self.get_ui_ports();
@ -399,7 +399,8 @@ impl UI {
]; ];
let keybindings = Table::new(keybindings, keybindings_widths) let keybindings = Table::new(keybindings, keybindings_widths)
.column_spacing(1) .column_spacing(1)
.block(Block::default().title("Keys").borders(Borders::ALL)); .block(Block::default().title("Keys").borders(Borders::ALL))
.style(Style::reset());
// keybindings // keybindings
frame.render_widget(keybindings, inner_area); frame.render_widget(keybindings, inner_area);