added blink support

This commit is contained in:
FKD13 2019-08-23 14:16:13 +02:00
parent 8a5b554240
commit 259f8e3506
No known key found for this signature in database
GPG key ID: C0B6C62B8313F2A1

View file

@ -17,14 +17,14 @@ colors = {
"P": "f", # Pink
"Y": "g", # Yellow
"W": "h", # White
"z": "i", # Light Black
"b": "j", # Light Blue
"g": "k", # Light Green
"m": "l", # Light Magenta
"r": "m", # Light Red
"p": "n", # Light Pink
"y": "o", # Light Yellow
"w": "p" # Light White
"z": "i", # Light/blink Black
"b": "j", # Light/blink Blue
"g": "k", # Light/blink Green
"m": "l", # Light/blink Magenta
"r": "m", # Light/blink Red
"p": "n", # Light/blink Pink
"y": "o", # Light/blink Yellow
"w": "p" # Light/blink White
}
def write_report(report):
@ -53,7 +53,7 @@ def printchar(c):
def change_color(background: str, foreground: str):
if background in colors and foreground in colors and background.isupper():
if background in colors and foreground in colors:
# DELETE keypress
write_report(NULL_CHAR*2+chr(0x2a)+NULL_CHAR*5)
release_keys()
@ -61,6 +61,7 @@ def change_color(background: str, foreground: str):
release_keys()
write_report(NULL_CHAR*2+chr(4 + ord(colors[foreground]) - ord('a'))+NULL_CHAR*5)
else:
print('Malformed Color code: §' + background + foreground)
write_report(chr(32)+NULL_CHAR+chr(0x38)+NULL_CHAR*5)
release_keys()