feat(tui): replace hard‑coded colors with Theme values and propagate Theme through UI rendering

- Introduce `Theme` import and pass a cloned `theme` instance to UI helpers (e.g., `render_editable_textarea`).
- Remove direct `Color` usage; UI now derives colors from `Theme` fields for placeholders, selections, ReAct components (thought, action, input, observation, final answer), status badges, operating mode badges, and model info panel.
- Extend `Theme` with new color fields for agent ReAct stages, badge foreground/background, and operating mode colors.
- Update rendering logic to apply these theme colors throughout the TUI (input panel, help text, status lines, model selection UI, etc.).
- Adjust imports to drop unused `Color` references.
This commit is contained in:
2025-10-12 15:16:20 +02:00
parent d2a193e5c1
commit 083b621b7d
4 changed files with 337 additions and 45 deletions

View File

@@ -9,7 +9,7 @@ use owlen_core::{
types::{ChatParameters, ChatResponse, Conversation, ModelInfo, Role},
ui::{AppState, AutoScroll, FocusedPanel, InputMode},
};
use ratatui::style::{Color, Modifier, Style};
use ratatui::style::{Modifier, Style};
use ratatui::text::{Line, Span};
use textwrap::wrap;
use tokio::{sync::mpsc, task::JoinHandle};
@@ -1372,9 +1372,10 @@ impl ChatApp {
// Sync buffer to textarea before entering visual mode
self.sync_buffer_to_textarea();
// Set a visible selection style
self.textarea.set_selection_style(
Style::default().bg(Color::LightBlue).fg(Color::Black),
);
let selection_style = Style::default()
.bg(self.theme.selection_bg)
.fg(self.theme.selection_fg);
self.textarea.set_selection_style(selection_style);
// Start visual selection at current cursor position
self.textarea.start_selection();
self.visual_start = Some(self.textarea.cursor());