From c5c0e359957e8c2158606c8c60d0b794f47d4f5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Orhun=20Parmaks=C4=B1z?= Date: Tue, 17 Sep 2024 15:04:35 +0300 Subject: [PATCH] feat(tui): improve the white theme support (#23) * feat(tui): improve white theme support * chore(state): add comment about termbg * refactor: simplify termbg usage --- Cargo.lock | 338 +++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 1 + src/tui/state.rs | 14 ++ src/tui/ui.rs | 131 +++++++++++++----- 4 files changed, 452 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 16a0d1c..488f5c3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -142,6 +142,125 @@ dependencies = [ "x11rb", ] +[[package]] +name = "async-channel" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" +dependencies = [ + "concurrent-queue", + "event-listener 2.5.3", + "futures-core", +] + +[[package]] +name = "async-channel" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b47800b0be77592da0afd425cc03468052844aff33b84e33cc696f64e77b6a" +dependencies = [ + "concurrent-queue", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-executor" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30ca9a001c1e8ba5149f91a74362376cc6bc5b919d92d988668657bd570bdcec" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "slab", +] + +[[package]] +name = "async-global-executor" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" +dependencies = [ + "async-channel 2.3.1", + "async-executor", + "async-io", + "async-lock", + "blocking", + "futures-lite", + "once_cell", +] + +[[package]] +name = "async-io" +version = "2.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "444b0228950ee6501b3568d3c93bf1176a1fdbc3b758dcd9475046d30f4dc7e8" +dependencies = [ + "async-lock", + "cfg-if", + "concurrent-queue", + "futures-io", + "futures-lite", + "parking", + "polling", + "rustix", + "slab", + "tracing", + "windows-sys 0.59.0", +] + +[[package]] +name = "async-lock" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" +dependencies = [ + "event-listener 5.3.1", + "event-listener-strategy", + "pin-project-lite", +] + +[[package]] +name = "async-std" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c634475f29802fde2b8f0b505b1bd00dfe4df7d4a000f0b36f7671197d5c3615" +dependencies = [ + "async-channel 1.9.0", + "async-global-executor", + "async-io", + "async-lock", + "crossbeam-utils", + "futures-channel", + "futures-core", + "futures-io", + "futures-lite", + "gloo-timers", + "kv-log-macro", + "log", + "memchr", + "once_cell", + "pin-project-lite", + "pin-utils", + "slab", + "wasm-bindgen-futures", +] + +[[package]] +name = "async-task" +version = "4.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "atty" version = "0.2.14" @@ -204,6 +323,7 @@ dependencies = [ "ratatui", "rust-strings", "sysinfo", + "termbg", "textwrap", "thiserror", "tui-big-text", @@ -235,6 +355,19 @@ dependencies = [ "objc2", ] +[[package]] +name = "blocking" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "703f41c54fc768e63e091340b424302bb1c29ef4aa0c7f10fe849dfb114d29ea" +dependencies = [ + "async-channel 2.3.1", + "async-task", + "futures-io", + "futures-lite", + "piper", +] + [[package]] name = "bumpalo" version = "3.16.0" @@ -407,6 +540,15 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "console" version = "0.15.8" @@ -668,6 +810,39 @@ version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0474425d51df81997e2f90a21591180b38eccf27292d755f3e30750225c175b" +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + +[[package]] +name = "event-listener" +version = "5.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6032be9bd27023a771701cc49f9f053c751055f71efb2e0ae5c15809093675ba" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f214dc438f977e6d4e3500aaa277f5ad94ca83fbbd9b1a15713ce2344ccc5a1" +dependencies = [ + "event-listener 5.3.1", + "pin-project-lite", +] + +[[package]] +name = "fastrand" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" + [[package]] name = "fnv" version = "1.0.7" @@ -698,6 +873,40 @@ dependencies = [ "autocfg", ] +[[package]] +name = "futures-channel" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" + +[[package]] +name = "futures-io" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" + +[[package]] +name = "futures-lite" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "parking", + "pin-project-lite", +] + [[package]] name = "gethostname" version = "0.4.3" @@ -720,6 +929,18 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +[[package]] +name = "gloo-timers" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb143cf96099802033e0d4f4963b19fd2e0b728bcf076cd9cf7f6634f092994" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + [[package]] name = "goblin" version = "0.8.2" @@ -776,6 +997,12 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" +[[package]] +name = "hermit-abi" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" + [[package]] name = "hex" version = "0.4.3" @@ -892,6 +1119,15 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "kv-log-macro" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" +dependencies = [ + "log", +] + [[package]] name = "lazy_static" version = "1.5.0" @@ -952,6 +1188,9 @@ name = "log" version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +dependencies = [ + "value-bag", +] [[package]] name = "lru" @@ -1178,6 +1417,12 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + [[package]] name = "parking_lot" version = "0.12.3" @@ -1213,12 +1458,50 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "piper" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" +dependencies = [ + "atomic-waker", + "fastrand", + "futures-io", +] + [[package]] name = "plain" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" +[[package]] +name = "polling" +version = "3.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc2790cd301dec6cd3b7a025e4815cf825724a51c98dccfe6a3e55f05ffb6511" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi 0.4.0", + "pin-project-lite", + "rustix", + "tracing", + "windows-sys 0.59.0", +] + [[package]] name = "pretty_assertions" version = "1.4.0" @@ -1463,6 +1746,15 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + [[package]] name = "smallvec" version = "1.13.2" @@ -1541,6 +1833,18 @@ dependencies = [ "windows", ] +[[package]] +name = "termbg" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bc77395d133abffe2ff55fc005178ae410973936f706833b8f75272154887f2" +dependencies = [ + "async-std", + "crossterm 0.28.1", + "thiserror", + "winapi", +] + [[package]] name = "terminal_size" version = "0.3.0" @@ -1597,6 +1901,22 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" + [[package]] name = "tui-big-text" version = "0.6.0" @@ -1708,6 +2028,12 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" +[[package]] +name = "value-bag" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a84c137d37ab0142f0f2ddfe332651fdbf252e7b7dbb4e67b6c1f1b2e925101" + [[package]] name = "version_check" version = "0.9.5" @@ -1756,6 +2082,18 @@ dependencies = [ "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" version = "0.2.93" diff --git a/Cargo.toml b/Cargo.toml index 708ee9e..fa380e5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,6 +43,7 @@ sysinfo = { version = "0.31.4", default-features = false, features = ["user"] } webbrowser = "1.0.1" lddtree = "0.3.5" itertools = "0.13.0" +termbg = "0.5.1" [dev-dependencies] pretty_assertions = "1.4.0" diff --git a/src/tui/state.rs b/src/tui/state.rs index c69c721..6a79902 100644 --- a/src/tui/state.rs +++ b/src/tui/state.rs @@ -1,5 +1,6 @@ use std::path::PathBuf; use std::sync::mpsc; +use std::time::Duration; use crate::error::{Error, Result}; use crate::prelude::Analyzer; @@ -9,6 +10,8 @@ use crate::tui::ui::{Tab, ELF_INFO_TABS, MAIN_TABS}; use crate::tui::widgets::SelectableList; use ansi_to_tui::IntoText; use heh::windows::Window; +use ratatui::style::Color; +use termbg::Theme; use tui_input::backend::crossterm::EventHandler; use tui_input::Input; @@ -47,6 +50,8 @@ pub struct State<'a> { pub notes_scroll_index: usize, /// File headers scroll index. pub headers_scroll_index: usize, + /// Terminal accent color. + pub accent_color: Color, } impl<'a> State<'a> { @@ -69,6 +74,15 @@ impl<'a> State<'a> { general_scroll_index: 0, notes_scroll_index: 0, headers_scroll_index: 0, + accent_color: termbg::theme(Duration::from_millis(10)) + .map(|theme| { + if theme == Theme::Dark { + Color::White + } else { + Color::Black + } + }) + .unwrap_or(Color::White), }; state.handle_tab()?; Ok(state) diff --git a/src/tui/ui.rs b/src/tui/ui.rs index a2cbe5c..7b2dc4d 100644 --- a/src/tui/ui.rs +++ b/src/tui/ui.rs @@ -110,7 +110,7 @@ pub fn render(state: &mut State, frame: &mut Frame) { .highlight_style( Style::default() .add_modifier(Modifier::BOLD) - .fg(Color::White), + .fg(state.accent_color), ); frame.render_widget(tabs, chunks[0]); let mut files = Vec::new(); @@ -222,7 +222,7 @@ pub fn render_general_info(state: &mut State, frame: &mut Frame, rect: Rect) { Line::default(), Line::default(), Line::from(vec![ - "Analyze ELF binaries ".white(), + "Analyze ELF binaries ".fg(state.accent_color), "like a boss.".yellow().italic(), ]), Line::from( @@ -248,69 +248,121 @@ pub fn render_general_info(state: &mut State, frame: &mut Frame, rect: Rect) { Line::from(vec![ "Size".cyan(), Span::raw(": ").fg(Color::Rgb(100, 100, 100)), - state.analyzer.file.size.to_string().white(), + state.analyzer.file.size.to_string().fg(state.accent_color), ]), Line::from(vec![ " ".into(), "Blocks".cyan(), Span::raw(": ").fg(Color::Rgb(100, 100, 100)), - state.analyzer.file.blocks.to_string().white(), + state + .analyzer + .file + .blocks + .to_string() + .fg(state.accent_color), " ".into(), ]), Line::from(vec![ "Block Size".cyan(), Span::raw(": ").fg(Color::Rgb(100, 100, 100)), - state.analyzer.file.block_size.to_string().white(), + state + .analyzer + .file + .block_size + .to_string() + .fg(state.accent_color), ]), Line::from(vec![ "Device".cyan(), Span::raw(": ").fg(Color::Rgb(100, 100, 100)), - state.analyzer.file.links.to_string().white(), + state.analyzer.file.links.to_string().fg(state.accent_color), ]), Line::from(vec![ "Inode".cyan(), Span::raw(": ").fg(Color::Rgb(100, 100, 100)), - state.analyzer.file.inode.to_string().white(), + state.analyzer.file.inode.to_string().fg(state.accent_color), ]), Line::from(vec![ "Links".cyan(), Span::raw(": ").fg(Color::Rgb(100, 100, 100)), - state.analyzer.file.links.to_string().white(), + state.analyzer.file.links.to_string().fg(state.accent_color), ]), Line::from(vec![ "Access".cyan(), Span::raw(": ").fg(Color::Rgb(100, 100, 100)), - state.analyzer.file.access.mode.to_string().white(), + state + .analyzer + .file + .access + .mode + .to_string() + .fg(state.accent_color), ]), Line::from(vec![ "Uid".cyan(), Span::raw(": ").fg(Color::Rgb(100, 100, 100)), - state.analyzer.file.access.uid.to_string().white(), + state + .analyzer + .file + .access + .uid + .to_string() + .fg(state.accent_color), ]), Line::from(vec![ "Gid".cyan(), Span::raw(": ").fg(Color::Rgb(100, 100, 100)), - state.analyzer.file.access.gid.to_string().white(), + state + .analyzer + .file + .access + .gid + .to_string() + .fg(state.accent_color), ]), Line::from(vec![ "Access".cyan(), Span::raw(": ").fg(Color::Rgb(100, 100, 100)), - state.analyzer.file.date.access.to_string().white(), + state + .analyzer + .file + .date + .access + .to_string() + .fg(state.accent_color), ]), Line::from(vec![ "Modify".cyan(), Span::raw(": ").fg(Color::Rgb(100, 100, 100)), - state.analyzer.file.date.modify.to_string().white(), + state + .analyzer + .file + .date + .modify + .to_string() + .fg(state.accent_color), ]), Line::from(vec![ "Change".cyan(), Span::raw(": ").fg(Color::Rgb(100, 100, 100)), - state.analyzer.file.date.change.to_string().white(), + state + .analyzer + .file + .date + .change + .to_string() + .fg(state.accent_color), ]), Line::from(vec![ "Birth".cyan(), Span::raw(": ").fg(Color::Rgb(100, 100, 100)), - state.analyzer.file.date.birth.to_string().white(), + state + .analyzer + .file + .date + .birth + .to_string() + .fg(state.accent_color), ]), ]; @@ -357,7 +409,13 @@ pub fn render_general_info(state: &mut State, frame: &mut Frame, rect: Rect) { "|".fg(Color::Rgb(100, 100, 100)), "File".cyan(), Span::raw(": ").fg(Color::Rgb(100, 100, 100)), - state.analyzer.file.name.to_string().white().bold(), + state + .analyzer + .file + .name + .to_string() + .fg(state.accent_color) + .bold(), "|".fg(Color::Rgb(100, 100, 100)), ])) .title_alignment(Alignment::Center) @@ -439,7 +497,7 @@ pub fn render_general_info(state: &mut State, frame: &mut Frame, rect: Rect) { Block::bordered() .title(vec![ "|".fg(Color::Rgb(100, 100, 100)), - "Dependencies".white().bold(), + "Dependencies".fg(state.accent_color).bold(), "|".fg(Color::Rgb(100, 100, 100)), ]) .title_alignment(Alignment::Center) @@ -484,7 +542,10 @@ pub fn render_static_analysis(state: &mut State, frame: &mut Frame, rect: Rect) Line::from(vec![ Span::styled(items[0].to_string(), Style::default().fg(Color::Cyan)), Span::raw(": ").fg(Color::Rgb(100, 100, 100)), - Span::styled(items[1].to_string(), Style::default().fg(Color::White)), + Span::styled( + items[1].to_string(), + Style::default().fg(state.accent_color), + ), ]) }) .collect(); @@ -530,12 +591,12 @@ pub fn render_static_analysis(state: &mut State, frame: &mut Frame, rect: Rect) Block::bordered() .title(vec![ "|".fg(Color::Rgb(100, 100, 100)), - "File Headers".white().bold(), + "File Headers".fg(state.accent_color).bold(), "|".fg(Color::Rgb(100, 100, 100)), ]) .border_style({ if state.block_index == 0 { - Style::default().fg(Color::White).bold() + Style::default().fg(state.accent_color).bold() } else { Style::default().fg(Color::Rgb(100, 100, 100)) } @@ -565,7 +626,7 @@ pub fn render_static_analysis(state: &mut State, frame: &mut Frame, rect: Rect) Block::bordered() .title(vec![ "|".fg(Color::Rgb(100, 100, 100)), - "Notes".white().bold(), + "Notes".fg(state.accent_color).bold(), "|".fg(Color::Rgb(100, 100, 100)), ]) .border_style(Style::default().fg(if state.block_index == 1 { @@ -601,7 +662,7 @@ pub fn render_static_analysis(state: &mut State, frame: &mut Frame, rect: Rect) .highlight_style( Style::default() .add_modifier(Modifier::BOLD) - .fg(Color::White), + .fg(state.accent_color), ); frame.render_widget(tabs, chunks[0]); let selected_index = state.list.state.selected().unwrap_or_default(); @@ -656,7 +717,7 @@ pub fn render_static_analysis(state: &mut State, frame: &mut Frame, rect: Rect) Line::from(vec![ "|".fg(Color::Rgb(100, 100, 100)), format!("{}/{}", selected_index.saturating_add(1), items_len) - .white() + .fg(state.accent_color) .bold(), "|".fg(Color::Rgb(100, 100, 100)), ]) @@ -706,7 +767,7 @@ pub fn render_static_analysis(state: &mut State, frame: &mut Frame, rect: Rect) .highlight_style( Style::default() .add_modifier(Modifier::BOLD) - .fg(Color::White), + .fg(state.accent_color), ); frame.render_widget(tabs, chunks[1]); render_details(state, rect, frame); @@ -781,7 +842,7 @@ pub fn render_strings(state: &mut State, frame: &mut Frame, rect: Rect) { Line::from(vec![ "|".fg(Color::Rgb(100, 100, 100)), format!("Min length: {}", state.analyzer.strings_len) - .white() + .fg(state.accent_color) .bold(), "|".fg(Color::Rgb(100, 100, 100)), ]) @@ -792,7 +853,7 @@ pub fn render_strings(state: &mut State, frame: &mut Frame, rect: Rect) { Line::from(vec![ "|".fg(Color::Rgb(100, 100, 100)), format!("{}/{}", selected_index.saturating_add(1), items_len) - .white() + .fg(state.accent_color) .bold(), "|".fg(Color::Rgb(100, 100, 100)), ]) @@ -891,7 +952,7 @@ fn render_details(state: &mut State<'_>, area: Rect, frame: &mut Frame<'_>) { lines.push(Line::from(vec![ Span::styled(headers[i].to_string(), Style::default().fg(Color::Cyan)), Span::raw(": ").fg(Color::Rgb(100, 100, 100)), - Span::styled(v, Style::default().fg(Color::White)), + Span::styled(v, Style::default().fg(state.accent_color)), ])); } lines @@ -899,7 +960,7 @@ fn render_details(state: &mut State<'_>, area: Rect, frame: &mut Frame<'_>) { .collect(); let popup = Popup::new(Text::from(lines)).title(Line::from(vec![ "|".fg(Color::Rgb(100, 100, 100)), - "Details".white().bold(), + "Details".fg(state.accent_color).bold(), "|".fg(Color::Rgb(100, 100, 100)), ])); frame.render_widget(&popup, area); @@ -944,14 +1005,20 @@ pub fn render_dynamic_analysis(state: &mut State, frame: &mut Frame, rect: Rect) Block::bordered() .title(vec![ "|".fg(Color::Rgb(100, 100, 100)), - "System Calls".white().bold(), + "System Calls".fg(state.accent_color).bold(), "|".fg(Color::Rgb(100, 100, 100)), ]) .title_bottom( Line::from(vec![ "|".fg(Color::Rgb(100, 100, 100)), "Total: ".into(), - state.analyzer.system_calls.len().to_string().white().bold(), + state + .analyzer + .system_calls + .len() + .to_string() + .fg(state.accent_color) + .bold(), "|".fg(Color::Rgb(100, 100, 100)), ]) .right_aligned(), @@ -986,7 +1053,7 @@ pub fn render_dynamic_analysis(state: &mut State, frame: &mut Frame, rect: Rect) .collect::>(); let popup = Popup::new(Text::from(summary)).title(Line::from(vec![ "|".fg(Color::Rgb(100, 100, 100)), - "Details".white().bold(), + "Details".fg(state.accent_color).bold(), "|".fg(Color::Rgb(100, 100, 100)), ])); frame.render_widget(&popup, rect); @@ -1000,7 +1067,7 @@ fn get_input_line<'a>(state: &'a State) -> Line<'a> { Line::from(vec![ "|".fg(Color::Rgb(100, 100, 100)), "search: ".yellow(), - state.input.value().white(), + state.input.value().fg(state.accent_color), if state.input_mode { " " } else { "" }.into(), "|".fg(Color::Rgb(100, 100, 100)), ])