Add color scheme helper and apply to menus and stats

This commit is contained in:
thePR0M3TH3AN committed 2025-07-05 19:06:46 -04:00
1 parent dd59a0e61b
commit e7d6b7d46e
3 files changed
+157 -104

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
"""Utility functions for SeedPass CLI color scheme."""
from termcolor import colored
# ANSI escape for 256-color orange (color code 208)
_ORANGE = "\033[38;5;208m"
_RESET = "\033[0m"
def _apply_orange(text: str) -> str:
"""Return text wrapped in ANSI codes for orange."""
return f"{_ORANGE}{text}{_RESET}"
# Mapping of semantic color categories to actual colors
_COLOR_MAP = {
"deterministic": "red",
"imported": "orange",
"index": "yellow",
"menu": "blue",
"stats": "green",
"default": "white",
}
def color_text(text: str, category: str = "default") -> str:
"""Colorize ``text`` according to the given category."""
color = _COLOR_MAP.get(category, "white")
if color == "orange":
return _apply_orange(text)
return colored(text, color)