color: init color util class
This commit is contained in:
parent
5623bebe34
commit
df65952cfc
1 changed files with 20 additions and 0 deletions
20
compiler/color.py
Normal file
20
compiler/color.py
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
import logging
|
||||||
|
|
||||||
|
logger = logging.Logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class Color(str):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def colored(text, *args, **kwargs):
|
||||||
|
return text
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
from termcolor import termcolor
|
||||||
|
|
||||||
|
Color = termcolor.Color
|
||||||
|
colored = termcolor.colored
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
logger.warning("termcolor is not installed, colored output won't be available")
|
||||||
Loading…
Add table
Add a link
Reference in a new issue