From b1faac8a7fab6d0d8be7803214e0066ea9467516 Mon Sep 17 00:00:00 2001 From: Bi Cheng Wu Date: Wed, 13 May 2020 06:24:22 -0500 Subject: [PATCH] added random color print statement; added GL73 to supported devices --- msi_perkeyrgb/main.py | 9 ++++----- msi_perkeyrgb/protocol_data/msi_keymaps.py | 2 +- msi_perkeyrgb/protocol_data/presets_index.py | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/msi_perkeyrgb/main.py b/msi_perkeyrgb/main.py index b353a49..b6a6bba 100755 --- a/msi_perkeyrgb/main.py +++ b/msi_perkeyrgb/main.py @@ -149,20 +149,19 @@ def main(): # # HLS was chosen instead of HVL due to being more human-friendly # see https://en.wikipedia.org/wiki/HSL_and_HSV#Motivation - col=webcolors.PercentRGB( + col_rgb_percent = webcolors.PercentRGB( *colorsys.hls_to_rgb( random.random(), # hue random.random()*.5+.25, # lightness random.random()*.5+.5 # saturation ) ) - colors_map, warnings = load_steady( - webcolors.rgb_percent_to_hex(["{:.2%}".format(val) for val in col])[1:], - msi_keymap - ) + col_hex = webcolors.rgb_percent_to_hex(["{:.2%}".format(val) for val in col_rgb_percent])[1:] + colors_map, warnings = load_steady(col_hex,msi_keymap) except ConfigError as e: print("Error preparing steady color : %s" % str(e)) sys.exit(1) + print("Setting keyboard color as #{}".format(col_hex)) kb.set_colors(colors_map) kb.refresh() diff --git a/msi_perkeyrgb/protocol_data/msi_keymaps.py b/msi_perkeyrgb/protocol_data/msi_keymaps.py index 705f346..60720dc 100644 --- a/msi_perkeyrgb/protocol_data/msi_keymaps.py +++ b/msi_perkeyrgb/protocol_data/msi_keymaps.py @@ -1,6 +1,6 @@ AVAILABLE_MSI_KEYMAPS = [ - (['GE63', 'GE73', 'GE75', 'GS63', 'GS73', 'GS75', 'GX63', 'GT63', 'GL63'], + (['GE63', 'GE73', 'GE75', 'GS63', 'GS73', 'GS75', 'GX63', 'GT63', 'GL63', 'GL73'], {9: 41, 10: 30, 11: 31, diff --git a/msi_perkeyrgb/protocol_data/presets_index.py b/msi_perkeyrgb/protocol_data/presets_index.py index d41faa4..c989487 100644 --- a/msi_perkeyrgb/protocol_data/presets_index.py +++ b/msi_perkeyrgb/protocol_data/presets_index.py @@ -1,4 +1,4 @@ PRESETS_FILES = [ - (['GE63', 'GE73', 'GE75', 'GS63', 'GS73', 'GS75', 'GX63', 'GT63', 'GL63'], '1.json'), + (['GE63', 'GE73', 'GE75', 'GS63', 'GS73', 'GS75', 'GX63', 'GT63', 'GL63', 'GL73'], '1.json'), (['GS65'], '2.json') ]