Skip to content

The agent that grows with you

test: preserve themed badge contrast on light terminals

Tekniumd538f4e9297d
diff --git a/contributors/emails/[email protected] b/contributors/emails/[email protected]
new file mode 100644
index 00000000000..eabaa93cb92
--- /dev/null
+++ b/contributors/emails/[email protected]
@@ -0,0 +1,2 @@
+pminervini
+# PR #104222 salvage
diff --git a/hermes_cli/skin_engine.py b/hermes_cli/skin_engine.py
index 8df06db4bb0..f4a662855d0 100644
--- a/hermes_cli/skin_engine.py
+++ b/hermes_cli/skin_engine.py
@@ -512,6 +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)
+ # This badge paints both sides; foreground-only light remapping destroys its contrast.
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")
diff --git a/tests/cli/test_cli_light_mode.py b/tests/cli/test_cli_light_mode.py
index 0763cc4ff67..fb5d3fb15e1 100644
--- a/tests/cli/test_cli_light_mode.py
+++ b/tests/cli/test_cli_light_mode.py
@@ -134,10 +134,29 @@ class TestLightModeRemap:
class TestSkinConfigHook:
- """The salvage wraps SkinConfig.get_color at module import time so
- every skin color read goes through the light-mode remap. Verify
- the hook installed and functions correctly.
- """
+ """Exercise the installed color hook, including self-painted badge colors."""
+
+ @pytest.mark.parametrize("skin_name", ["default", "sisyphus"])
+ def test_badge_preserves_its_paired_colors_in_light_mode(
+ self, cli_mod, monkeypatch, skin_name
+ ):
+ from hermes_cli.skin_engine import (
+ get_active_skin, get_prompt_toolkit_style_overrides, set_active_skin,
+ )
+
+ monkeypatch.setenv("HERMES_LIGHT", "1")
+ previous = get_active_skin().name
+ try:
+ set_active_skin(skin_name)
+ skin = get_active_skin()
+ background = skin.colors.get("status_bar_strong", skin.colors.get("banner_title", "#FFD700"))
+ foreground = skin.colors.get("status_bar_bg", "#1a1a2e")
+ assert get_prompt_toolkit_style_overrides()["status-bar-session-title"] == (
+ f"bg:{background} {foreground} bold"
+ )
+ finally:
+ set_active_skin(previous)
+
def test_hook_installed(self, cli_mod):
from hermes_cli.skin_engine import SkinConfig