diff options
| author | lukeflo | 2024-10-05 22:37:02 +0200 |
|---|---|---|
| committer | lukeflo | 2024-10-05 22:37:02 +0200 |
| commit | eeb8f1b39d965157ed3ea5f7bffae421cce435b3 (patch) | |
| tree | 89838d867f2ceb6f436e4a051054b6609c6f230b /src/frontend/ui.rs | |
| parent | 6717d6a9087180754eda66f89b348ce62b313e1e (diff) | |
| download | bibiman-eeb8f1b39d965157ed3ea5f7bffae421cce435b3.tar.gz bibiman-eeb8f1b39d965157ed3ea5f7bffae421cce435b3.zip | |
reordering src structure, cli args struct
Diffstat (limited to 'src/frontend/ui.rs')
| -rw-r--r-- | src/frontend/ui.rs | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/src/frontend/ui.rs b/src/frontend/ui.rs index 8b41974..8974a86 100644 --- a/src/frontend/ui.rs +++ b/src/frontend/ui.rs @@ -27,23 +27,25 @@ use ratatui::{ }, }; -use crate::{ - backend::bib::BibiEntry, - frontend::app::{App, TagListItem}, -}; +use crate::{backend::bib::BibiEntry, frontend::app::App, frontend::keywords::TagListItem}; use super::app::{CurrentArea, FormerArea}; const MAIN_BLUE_COLOR: Color = Color::Indexed(39); // const MAIN_PURPLE_COLOR: Color = Color::Indexed(129); const BOX_SELECTED_BOX_STYLE: Style = Style::new().fg(TEXT_FG_COLOR); -const BOX_UNSELECTED_BORDER_STYLE: Style = Style::new().fg(Color::DarkGray); +const BOX_SELECTED_TITLE_STYLE: Style = Style::new().fg(TEXT_FG_COLOR).add_modifier(Modifier::BOLD); +const BOX_UNSELECTED_BORDER_STYLE: Style = Style::new().fg(TEXT_UNSELECTED_FG_COLOR); +const BOX_UNSELECTED_TITLE_STYLE: Style = Style::new() + .fg(TEXT_UNSELECTED_FG_COLOR) + .add_modifier(Modifier::BOLD); const NORMAL_ROW_BG: Color = Color::Black; const ALT_ROW_BG_COLOR: Color = Color::Indexed(234); const SELECTED_STYLE: Style = Style::new() .add_modifier(Modifier::BOLD) .add_modifier(Modifier::REVERSED); const TEXT_FG_COLOR: Color = Color::Indexed(252); +const TEXT_UNSELECTED_FG_COLOR: Color = Color::Indexed(250); pub const fn alternate_colors(i: usize) -> Color { if i % 2 == 0 { @@ -117,7 +119,7 @@ impl App { }; let block = Block::bordered() - .title(search_title) + .title(Line::styled(search_title, BOX_SELECTED_TITLE_STYLE)) .border_style(BOX_SELECTED_BOX_STYLE) .border_set(symbols::border::THICK); Paragraph::new(self.search_struct.search_string.clone()) @@ -151,7 +153,17 @@ impl App { pub fn render_entrytable(&mut self, area: Rect, buf: &mut Buffer) { let block = Block::bordered() // can also be Block::new - .title(Line::raw(" Bibliographic Entries ").centered().bold()) + .title( + Line::styled( + " Bibliographic Entries ", + if let CurrentArea::EntryArea = self.current_area { + BOX_SELECTED_TITLE_STYLE + } else { + BOX_UNSELECTED_TITLE_STYLE + }, + ) + .centered(), + ) .border_set(if let CurrentArea::EntryArea = self.current_area { symbols::border::THICK } else { @@ -313,7 +325,17 @@ impl App { pub fn render_taglist(&mut self, area: Rect, buf: &mut Buffer) { let block = Block::bordered() - .title(Line::raw(" Keywords ").centered().bold()) + .title( + Line::styled( + " Keywords ", + if let CurrentArea::TagArea = self.current_area { + BOX_SELECTED_TITLE_STYLE + } else { + BOX_UNSELECTED_TITLE_STYLE + }, + ) + .centered(), + ) .border_set(if let CurrentArea::TagArea = self.current_area { symbols::border::THICK } else { |
