Skip to content

Commit

Permalink
Fix colors in the help box
Browse files Browse the repository at this point in the history
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."
  • Loading branch information
DeCarabas committed Aug 13, 2024
1 parent b381f71 commit 4fe255e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/client/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 4fe255e

Please sign in to comment.