Skip to content

Commit

Permalink
fix styling of some chars and strings in packetdump table
Browse files Browse the repository at this point in the history
  • Loading branch information
Chleba committed Mar 11, 2024
1 parent 133a94c commit 01cf799
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/components/packetdump.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use chrono::{DateTime, Local};
use color_eyre::eyre::Result;
use color_eyre::owo_colors::OwoColorize;
use crossterm::event::{KeyCode, KeyEvent};
use crossterm::style::Stylize;
use ipnetwork::Ipv4Network;
Expand Down Expand Up @@ -609,7 +610,7 @@ impl PacketDump {
}
}
let line = Line::from(spans);
Row::new(vec![Cell::from(t), Cell::from(line)])
Row::new(vec![Cell::from(Span::styled(t, Style::default().fg(Color::Cyan))), Cell::from(line)])
})
.collect();
rows
Expand Down Expand Up @@ -647,9 +648,12 @@ impl PacketDump {
.block(
Block::new()
.title(
ratatui::widgets::block::Title::from("|Packets|")
.position(ratatui::widgets::block::Position::Top)
.alignment(Alignment::Right),
ratatui::widgets::block::Title::from(Span::styled(
"|Packets|",
Style::default().fg(Color::Yellow),
))
.position(ratatui::widgets::block::Position::Top)
.alignment(Alignment::Right),
)
.title(
ratatui::widgets::block::Title::from(Line::from(type_titles))
Expand All @@ -659,8 +663,8 @@ impl PacketDump {
.title(
ratatui::widgets::block::Title::from(Line::from(vec![
Span::styled("|", Style::default().fg(Color::Yellow)),
String::from(char::from_u32(0x25b2).unwrap_or('>')).into(),
String::from(char::from_u32(0x25bc).unwrap_or('>')).into(),
Span::styled(String::from(char::from_u32(0x25b2).unwrap_or('>')), Style::default().fg(Color::Red)),
Span::styled(String::from(char::from_u32(0x25bc).unwrap_or('>')), Style::default().fg(Color::Red)),
Span::styled("select|", Style::default().fg(Color::Yellow)),
]))
.position(ratatui::widgets::block::Position::Bottom)
Expand All @@ -678,7 +682,8 @@ impl PacketDump {
.border_style(Style::default().fg(Color::Rgb(100, 100, 100)))
.borders(Borders::ALL), // .padding(Padding::new(1, 0, 2, 0)),
)
.highlight_symbol(String::from(char::from_u32(0x25b6).unwrap_or('>')))
.highlight_symbol(Span::styled(String::from(char::from_u32(0x25b6).unwrap_or('>')), Style::default().fg(Color::Red)))
// .highlight_style(Style::default().fg(Color::Red))
.column_spacing(1);
table
}
Expand Down

0 comments on commit 01cf799

Please sign in to comment.