Spaces:
Configuration error
Configuration error
Download openhands/utils/term_color.py from flyingdarkdev/README: direct link, hf CLI and curl.
- Browser
- Download file 524 Bytes
-
https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/openhands/utils/term_color.py
- Command line
-
hf download hf://spaces/flyingdarkdev/README/openhands/utils/term_color.py
-
curl -L -o term_color.py https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/openhands/utils/term_color.py
524 Bytes
| from enum import Enum | |
| from termcolor import colored | |
| class TermColor(Enum): | |
| """Terminal color codes.""" | |
| WARNING = 'yellow' | |
| SUCCESS = 'green' | |
| ERROR = 'red' | |
| INFO = 'blue' | |
| def colorize(text: str, color: TermColor = TermColor.WARNING) -> str: | |
| """Colorize text with specified color. | |
| Args: | |
| text (str): Text to be colored | |
| color (TermColor, optional): Color to use. Defaults to TermColor.WARNING | |
| Returns: | |
| str: Colored text | |
| """ | |
| return colored(text, color.value) | |