Skip to content

Commit b5a462e

Browse files
committed
fix: respect terminal ansi colors
1 parent d065c0b commit b5a462e

File tree

7 files changed

+38
-22
lines changed

7 files changed

+38
-22
lines changed

src/agent_chat_cli/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class AgentChatCLIApp(App):
3131
]
3232

3333
def __init__(self) -> None:
34-
super().__init__()
34+
super().__init__(ansi_color=True)
3535

3636
self.actions = Actions(app=self)
3737
self.agent_loop = AgentLoop(app=self)

src/agent_chat_cli/components/caret.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55

66
class Caret(Widget):
77
def compose(self) -> ComposeResult:
8-
yield Label("▷")
8+
yield Label("▷", classes="dim")

src/agent_chat_cli/components/header.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from textual.widget import Widget
33
from textual.widgets import Label
44

5+
from agent_chat_cli.components.flex import Flex
56
from agent_chat_cli.components.spacer import Spacer
67
from agent_chat_cli.utils.config import load_config
78
from agent_chat_cli.utils.mcp_server_status import MCPServerStatus
@@ -18,24 +19,20 @@ def compose(self) -> ComposeResult:
1819
"[bold]@ Agent CLI[/bold]",
1920
)
2021

21-
yield Label(
22-
f"[dim]Available MCP Servers: {mcp_servers}[/dim]",
23-
id="header-mcp-servers",
24-
)
22+
with Flex():
23+
yield Label("Available MCP Servers:", classes="dim")
24+
yield Label(f" {mcp_servers}", id="header-mcp-servers")
2525

2626
if agents:
27-
yield Label(
28-
f"[dim]Agents:[/dim] {agents}",
29-
id="header-agents",
30-
classes="header-agents",
31-
)
27+
with Flex():
28+
yield Label("Agents:", classes="dim")
29+
yield Label(f" {agents}")
3230

3331
yield Spacer()
3432

3533
yield Label(
36-
"[dim]Type your message and press Enter. Press / for commands.[/dim]",
37-
id="header-instructions",
38-
classes="header-instructions",
34+
"Type your message and press Enter. Press / for commands.",
35+
classes="dim",
3936
)
4037

4138
def on_mount(self) -> None:
@@ -59,7 +56,6 @@ def _handle_mcp_server_status(self) -> None:
5956
server_parts.append(f"[#ffa2dc][strike]{name}[/strike][/]")
6057

6158
mcp_servers = ", ".join(server_parts)
62-
markup = f"[dim]Available MCP Servers:[/dim] {mcp_servers}"
6359

6460
label = self.query_one("#header-mcp-servers", Label)
65-
label.update(markup)
61+
label.update(f" {mcp_servers}")

src/agent_chat_cli/components/messages.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class SystemMessage(Widget):
4747

4848
def compose(self) -> ComposeResult:
4949
yield Label("[bold][#debd00]System:[/][/bold]")
50-
yield Label(f"[dim]{self.message}[/dim]")
50+
yield Label(self.message, classes="dim")
5151

5252

5353
class UserMessage(Widget):
@@ -80,4 +80,4 @@ def compose(self) -> ComposeResult:
8080
label = f"[#FFD281]{escape('[tool]')} {self.tool_name}[/]"
8181

8282
yield Label(label)
83-
yield Label(f"[dim]{formatted_input}[/dim]", classes="tool-message")
83+
yield Label(formatted_input, classes="tool-message dim")

src/agent_chat_cli/components/thinking_indicator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class ThinkingIndicator(Widget):
1313
def compose(self) -> ComposeResult:
1414
with Flex():
1515
yield BalloonSpinner()
16-
yield Label("[dim]Agent is thinking...[/dim]")
16+
yield Label("Agent is thinking...", classes="dim")
1717

1818
def on_mount(self) -> None:
1919
self.display = False

src/agent_chat_cli/components/tool_permission_prompt.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ def __init__(self, actions: "Actions") -> None:
3232

3333
def compose(self) -> ComposeResult:
3434
yield Label("", id="tool-display")
35-
yield Label(" [dim]Allow? (Enter=yes, ESC=no, or ask another question):[/dim]")
35+
yield Label(
36+
" Allow? (Enter=yes, ESC=no, or ask another question):", classes="dim"
37+
)
3638

3739
yield Spacer()
3840

src/agent_chat_cli/core/styles.tcss

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ MarkdownH6 {
1010
}
1111

1212
Screen {
13-
background: #222;
13+
background: transparent;
1414
}
1515

1616
Spacer {
@@ -21,6 +21,7 @@ Flex {
2121
layout: horizontal;
2222
width: 100%;
2323
height: auto;
24+
background: transparent;
2425
}
2526

2627
VerticalScroll {
@@ -76,7 +77,6 @@ Caret {
7677
height: 1;
7778
width: auto;
7879
margin-right: 1;
79-
opacity: 0.5;
8080
}
8181

8282
TextArea {
@@ -91,6 +91,19 @@ TextArea {
9191
margin: 0;
9292
}
9393

94+
TextArea:focus {
95+
background: transparent;
96+
}
97+
98+
TextArea > * {
99+
background: transparent;
100+
}
101+
102+
TextArea .text-area--cursor {
103+
background: white;
104+
color: $text;
105+
}
106+
94107
.tool-message {
95108
padding-left: 2;
96109
}
@@ -111,3 +124,8 @@ SlashCommandMenu OptionList {
111124
border: solid $primary;
112125
background: $surface;
113126
}
127+
128+
129+
.dim {
130+
color: #888;
131+
}

0 commit comments

Comments
 (0)