fix(cli): preserve session-title badge contrast
This commit is contained in:
committed by
Teknium
parent
2b9e421da7
commit
85d25f3c29
@@ -481,7 +481,7 @@ _STYLE_TEMPLATES = {
|
||||
"placeholder": "{dim} italic", "prompt": "{prompt}", "prompt-working": "{dim} italic",
|
||||
"hint": "{dim} italic",
|
||||
"status-bar": "bg:{status_bg} {status_text}", "status-bar-strong": "bg:{status_bg} {status_strong} bold",
|
||||
"status-bar-session-title": "bg:{status_strong} {status_bg} bold",
|
||||
"status-bar-session-title": "bg:{badge_bg} {badge_fg} bold",
|
||||
"status-bar-dim": "bg:{status_bg} {status_dim}", "status-bar-good": "bg:{status_bg} {status_good} bold",
|
||||
"status-bar-warn": "bg:{status_bg} {status_warn} bold", "status-bar-bad": "bg:{status_bg} {status_bad} bold",
|
||||
"status-bar-critical": "bg:{status_bg} {status_critical} bold",
|
||||
@@ -512,4 +512,7 @@ def get_prompt_toolkit_style_overrides() -> Dict[str, str]:
|
||||
palette: Dict[str, str] = {}
|
||||
for name, key, fallback in _STYLE_PALETTE:
|
||||
palette[name] = skin.get_color(key, palette[fallback[1:]] if fallback.startswith("@") else fallback)
|
||||
palette["badge_bg"] = skin.colors.get(
|
||||
"status_bar_strong", skin.colors.get("banner_title", "#FFD700"))
|
||||
palette["badge_fg"] = skin.colors.get("status_bar_bg", "#1a1a2e")
|
||||
return {cls: tpl.format(**palette) for cls, tpl in _STYLE_TEMPLATES.items()}
|
||||
|
||||
@@ -273,3 +273,26 @@ class TestCliBrandingHelpers:
|
||||
overrides = get_prompt_toolkit_style_overrides()
|
||||
assert overrides["status-bar"] == f"bg:{skin.get_color('status_bar_bg')} {skin.get_color('banner_text')}"
|
||||
assert overrides["voice-status"] == f"bg:{skin.get_color('voice_status_bg')} {skin.get_color('ui_label')}"
|
||||
|
||||
def test_session_title_badge_preserves_paired_colors(self, monkeypatch):
|
||||
from hermes_cli.skin_engine import (
|
||||
SkinConfig,
|
||||
get_prompt_toolkit_style_overrides,
|
||||
set_active_skin,
|
||||
)
|
||||
|
||||
original_get_color = SkinConfig.get_color
|
||||
monkeypatch.setattr(
|
||||
SkinConfig,
|
||||
"get_color",
|
||||
lambda self, key, fallback="": (
|
||||
"#1A1A1A"
|
||||
if original_get_color(self, key, fallback) == "#F5F5F5"
|
||||
else original_get_color(self, key, fallback)
|
||||
),
|
||||
)
|
||||
set_active_skin("sisyphus")
|
||||
|
||||
assert get_prompt_toolkit_style_overrides()["status-bar-session-title"] == (
|
||||
"bg:#F5F5F5 #202020 bold"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user