Color scheme: green for facts/phrases/scores, blue for paths

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
sora 2026-09-11 03:18:52 +00:00
parent 0ca8aedefe
commit 98007cccd7

View File

@ -236,7 +236,7 @@ def _narration(msg: str) -> str:
import re as _re2
tail = _re2.sub(r'(?<![\w/%.])(\d+(?:/\d+)?(?:\s+[a-z-]+){0,4})(?=[\s,.]|$)',
r'[bold yellow]\1[/bold yellow]', tail)
r'[bold green]\1[/bold green]', tail)
return head + tail
# semantic PHRASES get color, not bare numbers: '164 samples from cache',
@ -245,12 +245,12 @@ def _narration(msg: str) -> str:
import re as _re0
msg = _re0.sub(r'(?<![\w/%.])(\d+(?:/\d+)?(?:\s+[a-z-]+){0,4})(?=[\s,.]|$)',
r'[bold yellow]\1[/bold yellow]', msg)
r'[bold green]\1[/bold green]', msg)
# highlight any trailing path after '->' or 'to' (only absolute paths)
for sep in ('-> ', 'to '):
head, _, tail = msg.rpartition(sep)
if head and tail.startswith('/'):
return f'{icon}{head}{sep}[cyan]{tail}[/cyan]'
return f'{icon}{head}{sep}[blue]{tail}[/blue]'
return f'{icon}{msg}'