feat(cli): skin-aware light/dark theme mode with terminal auto-detection

Add display.theme_mode setting (auto/light/dark) that makes the CLI
readable on light terminal backgrounds.

- Auto-detect terminal background via COLORFGBG, OSC 11, and macOS
  appearance (fallback chain in hermes_cli/colors.py)
- Add colors_light overrides to all 7 built-in skins with dark/readable
  colors for light backgrounds
- SkinConfig.get_color() now returns light overrides when theme is light
- get_prompt_toolkit_style_overrides() uses light bg colors for
  completion menus in light mode
- init_skin_from_config() reads display.theme_mode from config
- 7 new tests covering theme mode resolution, detection fallbacks,
  and light-mode skin overrides

Salvaged from PR #1187 by @peteromallet. Core design preserved;
adapted to current main (kept all existing helpers, tool_emojis,
convenience functions that were added after the PR branched).

Co-authored-by: Peter O'Mallet <peteromallet@users.noreply.github.com>
This commit is contained in:
teknium1
2026-03-17 02:51:31 -07:00
parent d156942419
commit a1c81360a5
5 changed files with 362 additions and 6 deletions

1
cli.py
View File

@@ -214,6 +214,7 @@ def load_cli_config() -> Dict[str, Any]:
"streaming": False,
"show_cost": False,
"skin": "default",
"theme_mode": "auto",
},
"clarify": {
"timeout": 120, # Seconds to wait for a clarify answer before auto-proceeding