diff --git a/bot_bottle/backend/terminal.py b/bot_bottle/backend/terminal.py index 66cb23a..87f991a 100644 --- a/bot_bottle/backend/terminal.py +++ b/bot_bottle/backend/terminal.py @@ -12,22 +12,13 @@ import shlex # uses true/24-bit colors for its own chrome, which would otherwise bypass # the palette entirely. _COLORS: dict[str, tuple[int, str, int, str, str]] = { - "black": (0, "#2d2d2d", 8, "#5c5c5c", "#0a0a0a"), - "red": (1, "#c0392b", 9, "#e74c3c", "#1a0707"), - "green": (2, "#27ae60", 10, "#2ecc71", "#071a09"), - "yellow": (3, "#d4ac0d", 11, "#f1c40f", "#1a1507"), - "blue": (4, "#2471a3", 12, "#3498db", "#07071a"), - "magenta": (5, "#7d3c98", 13, "#9b59b6", "#12071a"), - "cyan": (6, "#148f77", 14, "#1abc9c", "#071a1a"), - "white": (7, "#bdc3c7", 15, "#ecf0f1", "#111111"), - "bright-black": (8, "#5c5c5c", 0, "#2d2d2d", "#111111"), - "bright-red": (9, "#e74c3c", 1, "#c0392b", "#200808"), - "bright-green": (10, "#2ecc71", 2, "#27ae60", "#082008"), - "bright-yellow": (11, "#f1c40f", 3, "#d4ac0d", "#201808"), - "bright-blue": (12, "#3498db", 4, "#2471a3", "#080820"), - "bright-magenta": (13, "#9b59b6", 5, "#7d3c98", "#160820"), - "bright-cyan": (14, "#1abc9c", 6, "#148f77", "#082020"), - "bright-white": (15, "#ecf0f1", 7, "#bdc3c7", "#151515"), + "red": (9, "#e74c3c", 1, "#c0392b", "#200808"), + "green": (10, "#2ecc71", 2, "#27ae60", "#082008"), + "yellow": (11, "#f1c40f", 3, "#d4ac0d", "#201808"), + "blue": (12, "#3498db", 4, "#2471a3", "#080820"), + "magenta": (13, "#9b59b6", 5, "#7d3c98", "#160820"), + "cyan": (14, "#1abc9c", 6, "#148f77", "#082020"), + "white": (15, "#ecf0f1", 7, "#bdc3c7", "#151515"), } # OSC 104 resets all indexed palette entries; OSC 111 resets default background. diff --git a/bot_bottle/cli/list.py b/bot_bottle/cli/list.py index e895b72..1b34c66 100644 --- a/bot_bottle/cli/list.py +++ b/bot_bottle/cli/list.py @@ -11,22 +11,13 @@ from ..manifest import Manifest from ._common import PROG, USER_CWD _ANSI_COLOR_CODES: dict[str, str] = { - "black": "\033[30m", - "red": "\033[31m", - "green": "\033[32m", - "yellow": "\033[33m", - "blue": "\033[34m", - "magenta": "\033[35m", - "cyan": "\033[36m", - "white": "\033[37m", - "bright-black": "\033[90m", - "bright-red": "\033[91m", - "bright-green": "\033[92m", - "bright-yellow": "\033[93m", - "bright-blue": "\033[94m", - "bright-magenta": "\033[95m", - "bright-cyan": "\033[96m", - "bright-white": "\033[97m", + "red": "\033[91m", + "green": "\033[92m", + "yellow": "\033[93m", + "blue": "\033[94m", + "magenta": "\033[95m", + "cyan": "\033[96m", + "white": "\033[97m", } _ANSI_RESET = "\033[0m" diff --git a/bot_bottle/cli/tui.py b/bot_bottle/cli/tui.py index 2b8bb4c..dc4bd36 100644 --- a/bot_bottle/cli/tui.py +++ b/bot_bottle/cli/tui.py @@ -226,13 +226,10 @@ def _addstr_safe(screen: Any, row: int, col: int, text: str, attr: int = curses. # --------------------------------------------------------------------------- _ANSI_COLORS = [ - "red", "green", "blue", "yellow", "magenta", "cyan", "white", "black", - "bright-red", "bright-green", "bright-blue", "bright-yellow", - "bright-magenta", "bright-cyan", "bright-white", "bright-black", + "red", "green", "yellow", "blue", "magenta", "cyan", "white", ] _CURSES_COLOR_MAP: dict[str, int] = { - "black": curses.COLOR_BLACK, "red": curses.COLOR_RED, "green": curses.COLOR_GREEN, "yellow": curses.COLOR_YELLOW, @@ -379,13 +376,10 @@ def _init_color_pairs() -> dict[str, int]: curses.use_default_colors() pair_idx = 2 # pair 1 reserved for other uses for name in _ANSI_COLORS: - base = name.replace("bright-", "") - fg = _CURSES_COLOR_MAP.get(base, curses.COLOR_WHITE) + fg = _CURSES_COLOR_MAP.get(name, curses.COLOR_WHITE) try: curses.init_pair(pair_idx, fg, -1) - attr = curses.color_pair(pair_idx) - if name.startswith("bright-"): - attr |= curses.A_BOLD + attr = curses.color_pair(pair_idx) | curses.A_BOLD attrs[name] = attr pair_idx += 1 except curses.error: diff --git a/bot_bottle/contrib/claude/agent_provider.py b/bot_bottle/contrib/claude/agent_provider.py index 1f98465..75d3be3 100644 --- a/bot_bottle/contrib/claude/agent_provider.py +++ b/bot_bottle/contrib/claude/agent_provider.py @@ -42,41 +42,23 @@ def _prompt_path(guest_home: str) -> str: _STATUS_LINE_COLORS = { - "black": "\033[30m", - "red": "\033[31m", - "green": "\033[32m", - "yellow": "\033[33m", - "blue": "\033[34m", - "magenta": "\033[35m", - "cyan": "\033[36m", - "white": "\033[37m", - "bright-black": "\033[90m", - "bright-red": "\033[91m", - "bright-green": "\033[92m", - "bright-yellow": "\033[93m", - "bright-blue": "\033[94m", - "bright-magenta": "\033[95m", - "bright-cyan": "\033[96m", - "bright-white": "\033[97m", + "red": "\033[91m", + "green": "\033[92m", + "yellow": "\033[93m", + "blue": "\033[94m", + "magenta": "\033[95m", + "cyan": "\033[96m", + "white": "\033[97m", } _CLAUDE_THEME_COLORS = { - "black": "black", - "red": "red", - "green": "green", - "yellow": "yellow", - "blue": "blue", - "magenta": "magenta", - "cyan": "cyan", - "white": "white", - "bright-black": "blackBright", - "bright-red": "redBright", - "bright-green": "greenBright", - "bright-yellow": "yellowBright", - "bright-blue": "blueBright", - "bright-magenta": "magentaBright", - "bright-cyan": "cyanBright", - "bright-white": "whiteBright", + "red": "redBright", + "green": "greenBright", + "yellow": "yellowBright", + "blue": "blueBright", + "magenta": "magentaBright", + "cyan": "cyanBright", + "white": "whiteBright", } diff --git a/tests/unit/test_agent_provider.py b/tests/unit/test_agent_provider.py index ecb7e15..6237306 100644 --- a/tests/unit/test_agent_provider.py +++ b/tests/unit/test_agent_provider.py @@ -74,7 +74,7 @@ class TestAgentProviderRuntime(unittest.TestCase): instance_name="bot-bottle-test", prompt_file=prompt_file, label="review-api", - color="bright-cyan", + color="cyan", ) prompt = prompt_file.read_text() config = Path(tmp, "codex-config.toml").read_text() diff --git a/tests/unit/test_backend_terminal.py b/tests/unit/test_backend_terminal.py index 1f639c7..bdbab31 100644 --- a/tests/unit/test_backend_terminal.py +++ b/tests/unit/test_backend_terminal.py @@ -11,14 +11,14 @@ class TestPalettePrintf(unittest.TestCase): def test_known_color_returns_printf(self): cmd = palette_printf("red") self.assertTrue(cmd.startswith("printf '")) - self.assertIn("\\033]4;1;", cmd) # normal red - self.assertIn("\\033]4;9;", cmd) # bright red + self.assertIn("\\033]4;9;", cmd) # bright-red slot + self.assertIn("\\033]4;1;", cmd) # normal-red slot self.assertIn("\\033]11;", cmd) # default background tint - def test_bright_variant_sets_both_slots(self): - cmd = palette_printf("bright-blue") - self.assertIn("\\033]4;12;", cmd) # bright-blue - self.assertIn("\\033]4;4;", cmd) # blue + def test_color_sets_both_palette_slots(self): + cmd = palette_printf("blue") + self.assertIn("\\033]4;12;", cmd) # bright-blue slot + self.assertIn("\\033]4;4;", cmd) # normal-blue slot def test_unknown_color_returns_empty(self): self.assertEqual("", palette_printf("")) @@ -26,10 +26,7 @@ class TestPalettePrintf(unittest.TestCase): def test_all_named_colors_produce_output(self): colors = [ - "black", "red", "green", "yellow", - "blue", "magenta", "cyan", "white", - "bright-black", "bright-red", "bright-green", "bright-yellow", - "bright-blue", "bright-magenta", "bright-cyan", "bright-white", + "red", "green", "yellow", "blue", "magenta", "cyan", "white", ] for color in colors: with self.subTest(color=color): diff --git a/tests/unit/test_contrib_claude_provider.py b/tests/unit/test_contrib_claude_provider.py index 820e6b6..b704065 100644 --- a/tests/unit/test_contrib_claude_provider.py +++ b/tests/unit/test_contrib_claude_provider.py @@ -276,7 +276,7 @@ class TestClaudeUiProvision(unittest.TestCase): instance_name="bot-bottle-demo-abc12", prompt_file=prompt_file, label="research-ui", - color="bright-cyan", + color="cyan", ) settings = json.loads((state_dir / "claude-settings.json").read_text()) statusline = (state_dir / "claude-statusline.sh").read_text() diff --git a/tests/unit/test_contrib_codex_provider.py b/tests/unit/test_contrib_codex_provider.py index 6137fad..65a8ee2 100644 --- a/tests/unit/test_contrib_codex_provider.py +++ b/tests/unit/test_contrib_codex_provider.py @@ -158,7 +158,7 @@ class TestCodexProvisionPrompt(unittest.TestCase): instance_name="bot-bottle-demo-abc12", prompt_file=prompt_file, label="research-ui", - color="bright-cyan", + color="cyan", ) config = (state_dir / "codex-config.toml").read_text() prompt_text = prompt_file.read_text()