mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2026-10-30 09:22:03 +00:00
- Apply black formatting to 17 files. - Fix F821 undefined name errors in: - src/main.py: Add missing `queue` import. - src/seedpass/core/encryption.py: Fix `JSONDecodeError` reference. - src/utils/__init__.py: Fix exception variable scope in fallback code. - src/utils/key_derivation.py: Add `TYPE_CHECKING` imports. - src/seedpass/core/config_manager.py: Add `TYPE_CHECKING` imports. - Initialize torch environment and TODO file. Co-authored-by: PR0M3TH3AN <[email protected]>
36 lines
951 B
Python
36 lines
951 B
Python
"""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": "cyan",
|
|
"stats": "green",
|
|
"info": "white",
|
|
"warning": "yellow",
|
|
"error": "red",
|
|
"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)
|
|
attrs = ["bold"] if category in {"info", "warning", "error"} else []
|
|
return colored(text, color, attrs=attrs)
|