From e0b8f758fd77cf4044d8c451781b4be969d741a6 Mon Sep 17 00:00:00 2001 From: Muhammad Nauman Raza Date: Tue, 28 May 2024 21:29:46 +0100 Subject: [PATCH] feat: nicer styling of blocks --- src/ui.rs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/ui.rs b/src/ui.rs index 526c042..22096fe 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -1,6 +1,6 @@ use ratatui::{ prelude::*, - style::{Color, Style}, + style::Style, widgets::*, Frame, }; @@ -38,15 +38,16 @@ pub fn render(app: &mut App, frame: &mut Frame) { let scroll = app.input.visual_scroll(width as usize); let input = Paragraph::new(app.input.value()) - .style(match app.editing { - false => Style::default(), - true => Style::default().fg(Color::Yellow), - }) .scroll((0, scroll as u16)) + .style(Style::default().white().not_bold()) .block( Block::default() .borders(Borders::ALL) - .title("Search (Anime)"), + .title("Search (Anime)") + .style(match app.editing { + false => Style::default(), + true => Style::default().yellow().bold(), + }), ); frame.render_widget(input, chunks[1]); @@ -57,11 +58,11 @@ pub fn render(app: &mut App, frame: &mut Frame) { } let list = List::new(results) - .block(Block::bordered().title("Search Results")) - .style(match app.editing { + .block(Block::bordered().title("Search Results").style(match app.editing { true => Style::default(), - false => Style::default().fg(Color::Yellow), - }) + false => Style::default().yellow().bold(), + })) + .style(Style::default().white()) .highlight_style(Style::default().add_modifier(Modifier::ITALIC)) .highlight_symbol("┃ ") .repeat_highlight_symbol(true)