mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-14 18:19:37 +00:00
Add color scheme helper and apply to menus and stats
This commit is contained in:
32
src/utils/color_scheme.py
Normal file
32
src/utils/color_scheme.py
Normal 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)
|
Reference in New Issue
Block a user