Replace color definitions with colorama constants

pull/2122/head
Jimmy Brisson 2016-07-08 11:32:09 -05:00
parent bac254c7a3
commit e2c88373ee
1 changed files with 18 additions and 23 deletions

View File

@ -20,35 +20,30 @@ limitations under the License.
import sys import sys
import re import re
from colorama import init from colorama import init, Fore, Back, Style
init() init()
colors = { colors = {
'none' : "", 'none' : "",
'default' : "\033[.0m", 'default' : Style.RESET_ALL,
'bold' : "\033[.1m",
'underline' : "\033[.4m",
'blink' : "\033[.5m",
'reverse' : "\033[.7m",
'concealed' : "\033[.8m",
'black' : "\033[.30m", 'black' : Fore.BLACK,
'red' : "\033[.31m", 'red' : Fore.RED,
'green' : "\033[.32m", 'green' : Fore.GREEN,
'yellow' : "\033[.33m", 'yellow' : Fore.YELLOW,
'blue' : "\033[.34m", 'blue' : Fore.BLUE,
'magenta' : "\033[.35m", 'magenta' : Fore.MAGENTA,
'cyan' : "\033[.36m", 'cyan' : Fore.CYAN,
'white' : "\033[.37m", 'white' : Fore.WHITE,
'on_black' : "\033[.40m", 'on_black' : Back.BLACK,
'on_red' : "\033[.41m", 'on_red' : Back.RED,
'on_green' : "\033[.42m", 'on_green' : Back.GREEN,
'on_yellow' : "\033[.43m", 'on_yellow' : Back.YELLOW,
'on_blue' : "\033[.44m", 'on_blue' : Back.BLUE,
'on_magenta' : "\033[.45m", 'on_magenta' : Back.MAGENTA,
'on_cyan' : "\033[46m", 'on_cyan' : Back.CYAN,
'on_white' : "\033[47m", 'on_white' : Back.WHITE,
} }
# Convert a color string from a string into an ascii escape code that will print # Convert a color string from a string into an ascii escape code that will print