Changed theme colors
This commit is contained in:
parent
85ed7c798f
commit
19a0798e08
2 changed files with 35 additions and 17 deletions
|
|
@ -3,6 +3,10 @@ name = "process-killer-dashboard"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "pkd"
|
||||||
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
crossterm = "0.29.0"
|
crossterm = "0.29.0"
|
||||||
ratatui = "0.30.0"
|
ratatui = "0.30.0"
|
||||||
|
|
|
||||||
48
src/app.rs
48
src/app.rs
|
|
@ -5,6 +5,16 @@ use ratatui::{
|
||||||
text::{Line, Span},
|
text::{Line, Span},
|
||||||
widgets::{Block, Borders, Paragraph, Row, Table, TableState},
|
widgets::{Block, Borders, Paragraph, Row, Table, TableState},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Hacker theme palette
|
||||||
|
const ORANGE: Color = Color::Rgb(239, 147, 77);
|
||||||
|
const GREEN: Color = Color::Rgb(126, 201, 126);
|
||||||
|
const BLUE: Color = Color::Rgb(113, 180, 214);
|
||||||
|
const RED: Color = Color::Rgb(241, 110, 101);
|
||||||
|
const YELLOW: Color = Color::Rgb(232, 201, 126);
|
||||||
|
const CREAM: Color = Color::Rgb(244, 222, 205);
|
||||||
|
const HOVER: Color = Color::Rgb(42, 43, 42);
|
||||||
|
const DIM: Color = Color::Rgb(106, 106, 106);
|
||||||
use std::cmp::Reverse;
|
use std::cmp::Reverse;
|
||||||
use std::ffi::OsStr;
|
use std::ffi::OsStr;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
|
@ -118,48 +128,52 @@ pub fn draw_ui(
|
||||||
"CPU %",
|
"CPU %",
|
||||||
"Core %",
|
"Core %",
|
||||||
])
|
])
|
||||||
.style(Style::new().blue().bold()),
|
.style(Style::new().fg(ORANGE).bold()),
|
||||||
)
|
)
|
||||||
.block(
|
.block(
|
||||||
Block::default()
|
Block::default()
|
||||||
.borders(Borders::ALL)
|
.borders(Borders::ALL)
|
||||||
.title(" Process Manager ")
|
.border_style(Style::new().fg(DIM))
|
||||||
|
.title(Span::styled(" Process Manager ", Style::new().fg(ORANGE).bold()))
|
||||||
.title_bottom(
|
.title_bottom(
|
||||||
" Use ↑/↓ Scroll, q Quit, p Pause, / Search, Enter Apply/Confirm, Esc Clear/Cancel, y Confirm, n Cancel, k Soft Kill, K Force Kill, c CPU, m Memory, r Disk Read, w Disk Write, n Name, i PID ",
|
Span::styled(
|
||||||
|
" ↑/↓ Scroll q Quit p Pause / Search k Kill K Force Kill c CPU m Mem r Read w Write n Name i PID ",
|
||||||
|
Style::new().fg(DIM),
|
||||||
|
)
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.row_highlight_style(Style::new().bg(Color::Cyan).fg(Color::Black).bold())
|
.row_highlight_style(Style::new().bg(HOVER).fg(CREAM).bold())
|
||||||
.highlight_symbol(">> ");
|
.highlight_symbol(">> ");
|
||||||
|
|
||||||
let chunks = Layout::vertical([Constraint::Min(1), Constraint::Length(1)]).split(f.area());
|
let chunks = Layout::vertical([Constraint::Min(1), Constraint::Length(1)]).split(f.area());
|
||||||
let footer_chunks =
|
let footer_chunks =
|
||||||
Layout::horizontal([Constraint::Min(1), Constraint::Length(18)]).split(chunks[1]);
|
Layout::horizontal([Constraint::Min(1), Constraint::Length(18)]).split(chunks[1]);
|
||||||
let mode_color = match mode_label {
|
let mode_color = match mode_label {
|
||||||
"NORMAL" => Color::Green,
|
"NORMAL" => GREEN,
|
||||||
"SEARCH" => Color::Cyan,
|
"SEARCH" => BLUE,
|
||||||
"CONFIRM" => Color::Red,
|
"CONFIRM" => RED,
|
||||||
_ => Color::White,
|
_ => CREAM,
|
||||||
};
|
};
|
||||||
let status_color = if status.contains("failed") {
|
let status_color = if status.contains("failed") {
|
||||||
Color::Red
|
RED
|
||||||
} else if status.contains("cancelled") || status.contains("cleared") {
|
} else if status.contains("cancelled") || status.contains("cleared") {
|
||||||
Color::LightYellow
|
YELLOW
|
||||||
} else {
|
} else {
|
||||||
Color::Yellow
|
ORANGE
|
||||||
};
|
};
|
||||||
let footer = Line::from(vec![
|
let footer = Line::from(vec![
|
||||||
Span::styled("[", Style::new().fg(Color::DarkGray)),
|
Span::styled("[", Style::new().fg(DIM)),
|
||||||
Span::styled(mode_label, Style::new().fg(mode_color).bold()),
|
Span::styled(mode_label, Style::new().fg(mode_color).bold()),
|
||||||
Span::styled("] ", Style::new().fg(Color::DarkGray)),
|
Span::styled("] ", Style::new().fg(DIM)),
|
||||||
Span::styled(status, Style::new().fg(status_color)),
|
Span::styled(status, Style::new().fg(status_color)),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
let pause_label = if paused { "PAUSED" } else { "UNPAUSED" };
|
let pause_label = if paused { "PAUSED" } else { "LIVE" };
|
||||||
let pause_color = if paused { Color::Yellow } else { Color::Green };
|
let pause_color = if paused { YELLOW } else { GREEN };
|
||||||
let pause_badge = Line::from(vec![
|
let pause_badge = Line::from(vec![
|
||||||
Span::styled("[", Style::new().fg(Color::DarkGray)),
|
Span::styled("[", Style::new().fg(DIM)),
|
||||||
Span::styled(pause_label, Style::new().fg(pause_color).bold()),
|
Span::styled(pause_label, Style::new().fg(pause_color).bold()),
|
||||||
Span::styled("]", Style::new().fg(Color::DarkGray)),
|
Span::styled("]", Style::new().fg(DIM)),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
f.render_stateful_widget(table, chunks[0], state);
|
f.render_stateful_widget(table, chunks[0], state);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue