diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/app.rs | 8 | ||||
| -rw-r--r-- | src/config.rs | 4 | ||||
| -rw-r--r-- | src/tui/popup.rs | 1 | ||||
| -rw-r--r-- | src/tui/ui.rs | 28 |
4 files changed, 25 insertions, 16 deletions
@@ -314,7 +314,7 @@ impl App { let mut items = vec![( "Citekey: ".to_string(), entry.citekey.clone(), - PopupItem::Default, + PopupItem::Citekey, )]; if entry.doi_url.is_some() { items.push(( @@ -365,7 +365,7 @@ impl App { { if entry.doi_url.is_some() { items.push(( - "Weblink (DOI/URL): ".into(), + format!("{} ", cfg.general.link_symbol.clone().trim()), entry.doi_url.unwrap().clone(), PopupItem::Link, )) @@ -373,7 +373,7 @@ impl App { if entry.filepath.is_some() { entry.filepath.unwrap().iter().for_each(|p| { items.push(( - "File (PDF/EPUB): ".into(), + format!("{} ", cfg.general.file_symbol.clone().trim()), // p.clone().into_string().unwrap(), if entry.file_field && cfg.general.file_prefix.is_some() { cfg.general @@ -394,7 +394,7 @@ impl App { if entry.notes.is_some() { entry.notes.unwrap().iter().for_each(|n| { items.push(( - "Note: ".into(), + format!("{} ", cfg.general.note_symbol.clone().trim()), n.clone().into_string().unwrap(), PopupItem::Notefile, )); diff --git a/src/config.rs b/src/config.rs index 278f4b1..1f6c619 100644 --- a/src/config.rs +++ b/src/config.rs @@ -81,6 +81,7 @@ const DEFAULT_CONFIG: &str = r##" # confirm_color = "47" # warn_color = "124" # bar_bg_color = "234" +# popup_fg_color = "43" # popup_bg_color = "234" # selected_row_bg_color = "237" # note_color = "123" @@ -125,6 +126,7 @@ pub struct Colors { pub confirm_color: Color, pub warn_color: Color, pub bar_bg_color: Color, + pub popup_fg_color: Color, pub popup_bg_color: Color, pub selected_row_bg_color: Color, pub note_color: Color, @@ -211,6 +213,7 @@ impl BibiConfig { confirm_color: Color::Indexed(47), warn_color: Color::Indexed(124), bar_bg_color: Color::Indexed(235), + popup_fg_color: Color::Indexed(43), popup_bg_color: Color::Indexed(234), selected_row_bg_color: Color::Indexed(237), note_color: Color::Indexed(123), @@ -231,6 +234,7 @@ impl BibiConfig { keyword_color: Color::Indexed(58), info_color: Color::Indexed(57), bar_bg_color: Color::Indexed(144), + popup_fg_color: Color::Indexed(43), popup_bg_color: Color::Indexed(187), confirm_color: Color::Indexed(22), warn_color: Color::Indexed(124), diff --git a/src/tui/popup.rs b/src/tui/popup.rs index da44744..4aaa2c1 100644 --- a/src/tui/popup.rs +++ b/src/tui/popup.rs @@ -45,6 +45,7 @@ pub enum PopupItem { Bibfile, Entryfile, Notefile, + Citekey, Link, Default, None, diff --git a/src/tui/ui.rs b/src/tui/ui.rs index 2c30154..0a34e51 100644 --- a/src/tui/ui.rs +++ b/src/tui/ui.rs @@ -281,18 +281,22 @@ pub fn render_popup(app: &mut App, cfg: &BibiConfig, frame: &mut Frame) { .iter() .map( |(mes, obj, i)| { - let style = match i { - PopupItem::Bibfile => Style::new().fg(cfg.colors.entry_color), - PopupItem::Entryfile => Style::new().fg(cfg.colors.file_color), - PopupItem::Notefile => Style::new().fg(cfg.colors.note_color), - PopupItem::Link => Style::new().fg(cfg.colors.link_color), - PopupItem::Default => Style::new(), - PopupItem::None => Style::new(), + let style: Color = match i { + PopupItem::Bibfile => cfg.colors.entry_color, + PopupItem::Citekey => cfg.colors.entry_color, + PopupItem::Entryfile => cfg.colors.file_color, + PopupItem::Notefile => cfg.colors.note_color, + PopupItem::Link => cfg.colors.link_color, + PopupItem::Default => cfg.colors.main_text_color, + PopupItem::None => cfg.colors.main_text_color, }; - ListItem::from(Line::from(vec![ - Span::styled(mes, style.bold()), - Span::raw(obj), - ])) + ListItem::from( + Line::from(vec![ + Span::styled(mes, Style::new().bold()), + Span::raw(obj), + ]) + .fg(style), + ) }, // ListItem::from(mes.to_owned() + obj) ) .collect(); @@ -325,7 +329,7 @@ pub fn render_popup(app: &mut App, cfg: &BibiConfig, frame: &mut Frame) { .bg(cfg.colors.popup_bg_color), ) .border_set(symbols::border::THICK) - .border_style(Style::new().fg(cfg.colors.keyword_color)); + .border_style(Style::new().fg(cfg.colors.popup_fg_color)); let list = List::new(list_items).block(block).highlight_style( Style::new() |
