Skip to content

Commit 9eaf5a5

Browse files
Remove the /colors and /diff TUIs: theming owns those settings
The theme plugin's /themes picker drives banner colors and diff tints together, making the standalone prompt_toolkit menus redundant -- delete them instead of porting them to termflow. colors_menu.py survives as a pure data module (BANNER_COLORS / BANNER_DISPLAY_INFO / BANNER_SAMPLE_CONTENT) because the published theme plugin imports those constants from this path. Also removes the orphaned _show_color_options helper whose 'moved to builtin_commands' comment pointed at a file that does not exist.
1 parent d1b5132 commit 9eaf5a5

11 files changed

Lines changed: 40 additions & 1994 deletions

code_puppy/command_line/colors_menu.py

Lines changed: 10 additions & 444 deletions
Large diffs are not rendered by default.

code_puppy/command_line/command_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def _dispatch_custom_command(command: str, name: str):
186186
# MAIN COMMAND DISPATCHER
187187
# ============================================================================
188188

189-
# _show_color_options has been moved to builtin_commands.py
189+
# The /colors and /diff TUIs were removed: theming owns those settings now.
190190

191191

192192
def handle_command(command: str):

code_puppy/command_line/config_commands.py

Lines changed: 0 additions & 178 deletions
Original file line numberDiff line numberDiff line change
@@ -475,181 +475,3 @@ def handle_unpin_command(command: str) -> bool:
475475
except Exception as e:
476476
emit_error(t("cfg.unpin.failed", agent=agent_name, error=e))
477477
return True
478-
479-
480-
@register_command(
481-
name="diff",
482-
description="Configure diff highlighting colors (additions, deletions)",
483-
usage="/diff",
484-
category="config",
485-
)
486-
def handle_diff_command(command: str) -> bool:
487-
"""Configure diff highlighting colors."""
488-
import asyncio
489-
import concurrent.futures
490-
491-
from code_puppy.command_line.diff_menu import interactive_diff_picker
492-
from code_puppy.config import (
493-
set_diff_addition_color,
494-
set_diff_deletion_color,
495-
)
496-
from code_puppy.messaging import emit_error
497-
498-
# Show interactive picker for diff configuration
499-
with concurrent.futures.ThreadPoolExecutor() as executor:
500-
future = executor.submit(lambda: asyncio.run(interactive_diff_picker()))
501-
result = future.result(timeout=300) # 5 min timeout
502-
503-
if result:
504-
# Apply the changes silently (no console output)
505-
try:
506-
set_diff_addition_color(result["add_color"])
507-
set_diff_deletion_color(result["del_color"])
508-
except Exception as e:
509-
emit_error(t("cfg.diff.apply_failed", error=e))
510-
return True
511-
512-
513-
@register_command(
514-
name="colors",
515-
description="Configure banner colors for tool outputs (THINKING, SHELL COMMAND, etc.)",
516-
usage="/colors",
517-
category="config",
518-
)
519-
def handle_colors_command(command: str) -> bool:
520-
"""Configure banner colors via interactive TUI."""
521-
import asyncio
522-
import concurrent.futures
523-
524-
from code_puppy.command_line.colors_menu import interactive_colors_picker
525-
from code_puppy.config import set_banner_color
526-
from code_puppy.messaging import emit_error, emit_success
527-
528-
# Show interactive picker for banner color configuration
529-
with concurrent.futures.ThreadPoolExecutor() as executor:
530-
future = executor.submit(lambda: asyncio.run(interactive_colors_picker()))
531-
result = future.result(timeout=300) # 5 min timeout
532-
533-
if result:
534-
# Apply the changes
535-
try:
536-
for banner_name, color in result.items():
537-
set_banner_color(banner_name, color)
538-
emit_success(t("cfg.colors.saved"))
539-
except Exception as e:
540-
emit_error(t("cfg.colors.apply_failed", error=e))
541-
return True
542-
543-
544-
# ============================================================================
545-
# UTILITY FUNCTIONS
546-
# ============================================================================
547-
548-
549-
def _show_color_options(color_type: str):
550-
# ============================================================================
551-
# UTILITY FUNCTIONS
552-
# ============================================================================
553-
554-
"""Show available Rich color options organized by category."""
555-
from rich.text import Text
556-
557-
from code_puppy.messaging import emit_info
558-
559-
# Standard Rich colors organized by category
560-
color_categories = {
561-
"Basic Colors": [
562-
("black", "⚫"),
563-
("red", "🔴"),
564-
("green", "🟢"),
565-
("yellow", "🟡"),
566-
("blue", "🔵"),
567-
("magenta", "🟣"),
568-
("cyan", "🔷"),
569-
("white", "⚪"),
570-
],
571-
"Bright Colors": [
572-
("bright_black", "⚫"),
573-
("bright_red", "🔴"),
574-
("bright_green", "🟢"),
575-
("bright_yellow", "🟡"),
576-
("bright_blue", "🔵"),
577-
("bright_magenta", "🟣"),
578-
("bright_cyan", "🔷"),
579-
("bright_white", "⚪"),
580-
],
581-
"Special Colors": [
582-
("orange1", "🟠"),
583-
("orange3", "🟠"),
584-
("orange4", "🟠"),
585-
("deep_sky_blue1", "🔷"),
586-
("deep_sky_blue2", "🔷"),
587-
("deep_sky_blue3", "🔷"),
588-
("deep_sky_blue4", "🔷"),
589-
("turquoise2", "🔷"),
590-
("turquoise4", "🔷"),
591-
("steel_blue1", "🔷"),
592-
("steel_blue3", "🔷"),
593-
("chartreuse1", "🟢"),
594-
("chartreuse2", "🟢"),
595-
("chartreuse3", "🟢"),
596-
("chartreuse4", "🟢"),
597-
("gold1", "🟡"),
598-
("gold3", "🟡"),
599-
("rosy_brown", "🔴"),
600-
("indian_red", "🔴"),
601-
],
602-
}
603-
604-
# Suggested colors for each type
605-
if color_type == "additions":
606-
suggestions = [
607-
("green", "🟢"),
608-
("bright_green", "🟢"),
609-
("chartreuse1", "🟢"),
610-
("green3", "🟢"),
611-
("sea_green1", "🟢"),
612-
]
613-
emit_info(
614-
Text.from_markup(
615-
"[bold white on green]🎨 Recommended Colors for Additions:[/bold white on green]"
616-
)
617-
)
618-
for color, emoji in suggestions:
619-
emit_info(
620-
Text.from_markup(
621-
f" [cyan]{color:<16}[/cyan] [white on {color}]■■■■■■■■■■[/white on {color}] {emoji}"
622-
)
623-
)
624-
elif color_type == "deletions":
625-
suggestions = [
626-
("orange1", "🟠"),
627-
("red", "🔴"),
628-
("bright_red", "🔴"),
629-
("indian_red", "🔴"),
630-
("dark_red", "🔴"),
631-
]
632-
emit_info(
633-
Text.from_markup(
634-
"[bold white on orange1]🎨 Recommended Colors for Deletions:[/bold white on orange1]"
635-
)
636-
)
637-
for color, emoji in suggestions:
638-
emit_info(
639-
Text.from_markup(
640-
f" [cyan]{color:<16}[/cyan] [white on {color}]■■■■■■■■■■[/white on {color}] {emoji}"
641-
)
642-
)
643-
644-
emit_info("\n" + t("cfg.colors.all_available"))
645-
for category, colors in color_categories.items():
646-
emit_info(f"\n{category}:")
647-
# Display in columns for better readability
648-
for i in range(0, len(colors), 4):
649-
row = colors[i : i + 4]
650-
row_text = " ".join([f"[{color}]■[/{color}] {color}" for color, _ in row])
651-
emit_info(Text.from_markup(f" {row_text}"))
652-
653-
emit_info("\n" + t("cfg.colors.usage"))
654-
emit_info(t("cfg.colors.white_text_note"))
655-
emit_info(t("cfg.colors.hex_note"))

0 commit comments

Comments
 (0)