colors
This commit is contained in:
@@ -18,20 +18,24 @@ use std::time::{Duration, Instant};
|
||||
use tokio::sync::mpsc;
|
||||
|
||||
// Retro sci-fi color scheme inspired by Alien terminals
|
||||
const TERMINAL_GREEN: Color = Color::Rgb(80, 105, 83); // Softer vintage green
|
||||
const TERMINAL_GREEN: Color = Color::Rgb(136, 244, 152); // Mid green
|
||||
const TERMINAL_AMBER: Color = Color::Rgb(242, 204, 148); // Softer amber for warnings
|
||||
const TERMINAL_DIM_GREEN: Color = Color::Rgb(154, 174, 135); // Same softer green for borders
|
||||
const TERMINAL_DIM_GREEN: Color = Color::Rgb(154, 174, 135); // softer vintage green for borders
|
||||
const TERMINAL_BG: Color = Color::Rgb(0, 10, 0); // Very dark green background
|
||||
const TERMINAL_CYAN: Color = Color::Rgb(0, 255, 255); // Cyan for highlights
|
||||
const TERMINAL_RED: Color = Color::Rgb(255, 0, 0); // Red for errors
|
||||
const TERMINAL_PALE_BLUE: Color = Color::Rgb(173, 216, 230); // Pale blue for READY status
|
||||
const TERMINAL_RED: Color = Color::Rgb(239, 119, 109); // Red for errors or negative diffs
|
||||
const TERMINAL_PALE_BLUE: Color = Color::Rgb(173, 234, 251); // Pale blue for READY status
|
||||
const TERMINAL_DARK_AMBER: Color = Color::Rgb(204, 119, 34); // Dark amber for PROCESSING status
|
||||
const TERMINAL_WHITE: Color = Color::Rgb(218, 218, 219); // Dimmer white for punchy text
|
||||
|
||||
/// Message types for communication between threads
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum TuiMessage {
|
||||
AgentOutput(String),
|
||||
ToolOutput { name: String, content: String },
|
||||
ToolOutput {
|
||||
name: String,
|
||||
content: String,
|
||||
},
|
||||
SystemStatus(String),
|
||||
ContextUpdate {
|
||||
used: u32,
|
||||
@@ -141,18 +145,35 @@ impl TerminalState {
|
||||
// Wrap long lines if needed
|
||||
let max_content_width = box_width - 4; // Account for borders and padding
|
||||
if line.len() <= max_content_width {
|
||||
self.output_history.push(format!("{} {:<width$} {}", vertical, line, vertical, width = max_content_width));
|
||||
self.output_history.push(format!(
|
||||
"{} {:<width$} {}",
|
||||
vertical,
|
||||
line,
|
||||
vertical,
|
||||
width = max_content_width
|
||||
));
|
||||
} else {
|
||||
// Simple word wrapping for long lines
|
||||
for chunk in line.chars().collect::<Vec<_>>().chunks(max_content_width) {
|
||||
let chunk_str: String = chunk.iter().collect();
|
||||
self.output_history.push(format!("{} {:<width$} {}", vertical, chunk_str, vertical, width = max_content_width));
|
||||
self.output_history.push(format!(
|
||||
"{} {:<width$} {}",
|
||||
vertical,
|
||||
chunk_str,
|
||||
vertical,
|
||||
width = max_content_width
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add bottom border
|
||||
self.output_history.push(format!("{}{}{}", corner_bl, border_char.repeat(box_width - 2), corner_br));
|
||||
self.output_history.push(format!(
|
||||
"{}{}{}",
|
||||
corner_bl,
|
||||
border_char.repeat(box_width - 2),
|
||||
corner_br
|
||||
));
|
||||
self.output_history.push(String::new()); // Empty line after box
|
||||
// Auto-scroll to bottom only if user hasn't manually scrolled
|
||||
if !self.manual_scroll {
|
||||
@@ -398,7 +419,8 @@ impl RetroTui {
|
||||
|
||||
// Ensure scroll offset is within valid range
|
||||
// Clamp the scroll offset but ensure we can still see content at the bottom
|
||||
let scroll = if scroll_offset + visible_height > total_lines && total_lines > visible_height {
|
||||
let scroll = if scroll_offset + visible_height > total_lines && total_lines > visible_height
|
||||
{
|
||||
// Adjust scroll to show the last visible_height lines
|
||||
total_lines.saturating_sub(visible_height)
|
||||
} else {
|
||||
@@ -426,8 +448,15 @@ impl RetroTui {
|
||||
}
|
||||
|
||||
// Check if this is a box border line
|
||||
if line.starts_with("┌") || line.starts_with("└") || line.starts_with("│") || line.starts_with("├") {
|
||||
return Line::from(Span::styled(format!(" {}", line), Style::default().fg(TERMINAL_DIM_GREEN)));
|
||||
if line.starts_with("┌")
|
||||
|| line.starts_with("└")
|
||||
|| line.starts_with("│")
|
||||
|| line.starts_with("├")
|
||||
{
|
||||
return Line::from(Span::styled(
|
||||
format!(" {}", line),
|
||||
Style::default().fg(TERMINAL_DIM_GREEN),
|
||||
));
|
||||
}
|
||||
// Apply different colors based on content
|
||||
let style = if line.starts_with("ERROR:") {
|
||||
@@ -583,7 +612,10 @@ impl RetroTui {
|
||||
|
||||
/// Send tool output to the terminal
|
||||
pub fn tool_output(&self, name: &str, content: &str) {
|
||||
let _ = self.tx.send(TuiMessage::ToolOutput { name: name.to_string(), content: content.to_string() });
|
||||
let _ = self.tx.send(TuiMessage::ToolOutput {
|
||||
name: name.to_string(),
|
||||
content: content.to_string(),
|
||||
});
|
||||
}
|
||||
|
||||
/// Update system status
|
||||
|
||||
Reference in New Issue
Block a user