Add colorama to scripts.utils
This commit is contained in:
parent
a7c1f38344
commit
bd11913a4a
@ -19,10 +19,22 @@
|
|||||||
|
|
||||||
"""Utility functions for scripts."""
|
"""Utility functions for scripts."""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
use_color = True
|
use_color = True
|
||||||
|
|
||||||
|
|
||||||
|
# Import side-effects are an evil thing, but here it's okay so scripts using
|
||||||
|
# colors work on Windows as well.
|
||||||
|
try:
|
||||||
|
import colorama
|
||||||
|
except ImportError:
|
||||||
|
if os.name == 'nt':
|
||||||
|
use_color = False
|
||||||
|
else:
|
||||||
|
colorama.init()
|
||||||
|
|
||||||
|
|
||||||
fg_colors = {
|
fg_colors = {
|
||||||
'black': 30,
|
'black': 30,
|
||||||
'red': 31,
|
'red': 31,
|
||||||
|
Loading…
Reference in New Issue
Block a user