CoolFace
Apppublic

Backup-bdg/OpenHands

sourceHugging Faceapache-2.0updated 1y agoView on Hugging Face
0likes
term_color.py26 linesDownload Raw Back to utils
1from enum import Enum2 3from termcolor import colored4 5 6class TermColor(Enum):7    """Terminal color codes."""8 9    WARNING = 'yellow'10    SUCCESS = 'green'11    ERROR = 'red'12    INFO = 'blue'13 14 15def colorize(text: str, color: TermColor = TermColor.WARNING) -> str:16    """Colorize text with specified color.17 18    Args:19        text (str): Text to be colored20        color (TermColor, optional): Color to use. Defaults to TermColor.WARNING21 22    Returns:23        str: Colored text24    """25    return colored(text, color.value)26