Preserve prompt contrast when terminal colors are unavailable (#59257)

## Why

Submitted prompts need readable foreground and background colors when the terminal does not report its default colors.

## What changed

- Use a contrasting gray pair for truecolor and 256-color terminals when default colors are unavailable. Keep terminal defaults for 16-color terminals and unknown color support.
- Preserve voice markers, inline element accents, and asynchronous reply code colors when applying prompt styles to native history.

## Testing

Add contrast coverage for each color level and terminal rendering regressions for inline elements and asynchronous reply code colors. Update prompt snapshots to cover the fallback colors.

GitOrigin-RevId: dcda0fc3e2b12a5dc9046322a4d82c61986e3ecd
This commit is contained in:
Eric Traut
2026-11-03 23:36:55 +00:00
committed by copyberry
parent d582332d03
commit b59f2e27a0
15 changed files with 158 additions and 61 deletions
@@ -12,8 +12,8 @@ expression: persisted
Line::default().bg(Color::Rgb(57, 57, 57)),
Line::from_iter([
Span::from(" "),
Span::from("Answer from "),
Span::from("desktop").fg(Color::Rgb(243, 139, 168)).bold(),
Span::from("Answer from ").bg(Color::Rgb(57, 57, 57)),
Span::from("desktop").fg(Color::Rgb(243, 139, 168)).bg(Color::Rgb(57, 57, 57)).bold(),
]).bg(Color::Rgb(57, 57, 57)),
Line::default().bg(Color::Rgb(57, 57, 57)),
]