data_beans/interactive/
ui.rs1use ratatui::crossterm::event::KeyEvent;
6use ratatui::style::{Color, Modifier, Style};
7
8pub use legume_tui::hist::{
9 compact, median, BarValue, Binned, Binning, HistPlot, MirrorPlot, MirrorSide, Scale,
10};
11pub use legume_tui::view::{
12 header, help_line, input_line, modes_of, notify, panel, run_screen_in, run_screen_in_with,
13 title_bar, Screen, Tui, TICK,
14};
15pub use legume_tui::Look;
16
17const ACCENT: Color = Color::Rgb(217, 119, 87);
20
21pub const LOOK: Look = Look::new(
25 Style::new(),
26 Style::new().add_modifier(Modifier::BOLD),
27 Style::new().add_modifier(Modifier::DIM),
28 Style::new().add_modifier(Modifier::REVERSED),
29 Style::new().add_modifier(Modifier::DIM),
30 Style::new().fg(ACCENT),
31);
32
33pub fn copy(text: &str) {
36 let _ = legume_tui::keys::copy(text, true);
38}
39
40pub fn run_screen<S: Screen>(screen: &mut S) -> anyhow::Result<()> {
43 Ok(legume_tui::view::run_screen(&super::TOOL, screen)?)
44}
45
46pub fn run_screen_with<S: Screen>(
49 screen: &mut S,
50 on_key: impl FnMut(&mut S, KeyEvent),
51) -> anyhow::Result<()> {
52 Ok(legume_tui::view::run_screen_with(
53 &super::TOOL,
54 screen,
55 on_key,
56 )?)
57}