Skip to main content

claude_code_rust/ui/
theme.rs

1// Claude Code Rust - A native Rust terminal interface for Claude Code
2// Copyright (C) 2025  Simon Peter Rothgang
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU Affero General Public License as
6// published by the Free Software Foundation, either version 3 of the
7// License, or (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12// GNU Affero General Public License for more details.
13//
14// You should have received a copy of the GNU Affero General Public License
15// along with this program.  If not, see <https://www.gnu.org/licenses/>.
16
17use ratatui::style::Color;
18
19// Accent
20pub const RUST_ORANGE: Color = Color::Rgb(244, 118, 0);
21
22// UI chrome
23pub const DIM: Color = Color::DarkGray;
24pub const PROMPT_CHAR: &str = "❯";
25pub const SEPARATOR_CHAR: &str = "─";
26
27// Role header colors
28pub const ROLE_ASSISTANT: Color = RUST_ORANGE;
29
30// User message background
31pub const USER_MSG_BG: Color = Color::Rgb(40, 44, 52);
32
33// Tool status icons
34pub const ICON_COMPLETED: &str = "\u{2713}"; // ✓
35pub const ICON_FAILED: &str = "\u{2717}"; // ✗
36
37// Status colors
38pub const STATUS_ERROR: Color = Color::Red;
39pub const SLASH_COMMAND: Color = Color::LightMagenta;
40
41/// Tool kind icon + label pair. Monochrome Unicode symbols.
42/// If `claude_tool_name` is provided, override icon/label for specific tools.
43pub fn tool_kind_label(
44    kind: agent_client_protocol::ToolKind,
45    claude_tool_name: Option<&str>,
46) -> (&'static str, &'static str) {
47    use agent_client_protocol::ToolKind;
48
49    // Override for specific Claude Code tool names
50    if let Some(name) = claude_tool_name {
51        match name {
52            "Task" => return ("◇", "Agent"),
53            "WebSearch" => return ("⊕", "Search"),
54            "WebFetch" => return ("⊕", "Fetch"),
55            _ => {}
56        }
57    }
58
59    match kind {
60        ToolKind::Read => ("⬚", "Read"),
61        ToolKind::Edit => ("▣", "Edit"),
62        ToolKind::Delete => ("▣", "Delete"),
63        ToolKind::Move => ("⇄", "Move"),
64        ToolKind::Search => ("⌕", "Find"),
65        ToolKind::Execute => ("⟩", "Bash"),
66        ToolKind::Think => ("❖", "Think"),
67        ToolKind::Fetch => ("⊕", "Fetch"),
68        ToolKind::SwitchMode => ("⊙", "Mode"),
69        _ => ("○", "Tool"),
70    }
71}