Color scheme: green for facts/phrases/scores, blue for paths
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
0ca8aedefe
commit
98007cccd7
@ -236,7 +236,7 @@ def _narration(msg: str) -> str:
|
|||||||
import re as _re2
|
import re as _re2
|
||||||
|
|
||||||
tail = _re2.sub(r'(?<![\w/%.])(\d+(?:/\d+)?(?:\s+[a-z-]+){0,4})(?=[\s,.]|$)',
|
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
|
return head + tail
|
||||||
|
|
||||||
# semantic PHRASES get color, not bare numbers: '164 samples from cache',
|
# semantic PHRASES get color, not bare numbers: '164 samples from cache',
|
||||||
@ -245,12 +245,12 @@ def _narration(msg: str) -> str:
|
|||||||
import re as _re0
|
import re as _re0
|
||||||
|
|
||||||
msg = _re0.sub(r'(?<![\w/%.])(\d+(?:/\d+)?(?:\s+[a-z-]+){0,4})(?=[\s,.]|$)',
|
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)
|
# highlight any trailing path after '->' or 'to' (only absolute paths)
|
||||||
for sep in ('-> ', 'to '):
|
for sep in ('-> ', 'to '):
|
||||||
head, _, tail = msg.rpartition(sep)
|
head, _, tail = msg.rpartition(sep)
|
||||||
if head and tail.startswith('/'):
|
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}'
|
return f'{icon}{msg}'
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user