diff --git a/src/client/colors.rs b/src/client/colors.rs index c02d8b6..78f8255 100644 --- a/src/client/colors.rs +++ b/src/client/colors.rs @@ -11,8 +11,9 @@ pub struct Theme { pub border: Color, } -impl Default for Theme { - fn default() -> Self { +impl Theme { + // Default light theme + pub fn light() -> Self { Self { bg: Color::Rgb(245, 245, 245), // Light gray fg: Color::Rgb(64, 64, 64), // Dark gray @@ -22,4 +23,34 @@ impl Default for Theme { border: Color::Rgb(220, 220, 220), // Light gray border } } + + // High-contrast dark theme + pub fn dark() -> Self { + Self { + bg: Color::Rgb(30, 30, 30), // Dark background + fg: Color::Rgb(255, 255, 255), // White text + accent: Color::Rgb(0, 191, 255), // Bright blue + highlight: Color::Rgb(50, 205, 50), // Bright green + warning: Color::Rgb(255, 99, 71), // Bright red + border: Color::Rgb(100, 100, 100), // Medium gray border + } + } + + // High-contrast light theme + pub fn high_contrast() -> Self { + Self { + bg: Color::Rgb(255, 255, 255), // White background + fg: Color::Rgb(0, 0, 0), // Black text + accent: Color::Rgb(0, 0, 255), // Blue + highlight: Color::Rgb(0, 128, 0), // Green + warning: Color::Rgb(255, 0, 0), // Red + border: Color::Rgb(0, 0, 0), // Black border + } + } +} + +impl Default for Theme { + fn default() -> Self { + Self::light() // Default to light theme + } } diff --git a/src/client/components/command_line.rs b/src/client/components/command_line.rs index 1d8b100..38f3cc6 100644 --- a/src/client/components/command_line.rs +++ b/src/client/components/command_line.rs @@ -8,7 +8,11 @@ use ratatui::{ use crate::client::colors::Theme; pub fn render_command_line(f: &mut Frame, area: Rect, input: &str, active: bool, theme: &Theme) { - let prompt = if active { ":" } else { "Press ':' for commands" }; + let prompt = if active { + ": (w = save, q = quit)" + } else { + "Press ':' for commands (w = save, q = quit)" + }; let style = if active { Style::default().fg(theme.accent) } else { diff --git a/src/client/ui.rs b/src/client/ui.rs index 44a1e8c..1ddc291 100644 --- a/src/client/ui.rs +++ b/src/client/ui.rs @@ -48,7 +48,7 @@ pub async fn run_client() -> Result<(), Box> { ]; let mut command_mode = false; let mut command_input = String::new(); - let theme = Theme::default(); + let theme = Theme::dark(); loop { terminal.draw(|f| { @@ -112,7 +112,34 @@ pub async fn run_client() -> Result<(), Box> { } continue; } - + if command_mode { + match key.code { + KeyCode::Enter => { + match command_input.as_str() { + "w" => break, // Save and exit + "q" => { // Quit without saving + disable_raw_mode()?; + execute!(terminal.backend_mut(), LeaveAlternateScreen)?; + return Ok(()); + } + _ => { + command_mode = false; + command_input.clear(); + } + } + } + KeyCode::Char(c) => command_input.push(c), + KeyCode::Backspace => { + command_input.pop(); + } + KeyCode::Esc => { + command_mode = false; + command_input.clear(); + } + _ => {} + } + continue; + } match key.code { KeyCode::Char(':') => { command_mode = true;