msi-perkeyrgb icon indicating copy to clipboard operation
msi-perkeyrgb copied to clipboard

Added css3 webcolor support for steady colors & random color option

Open bwu62 opened this issue 4 years ago • 3 comments

Added few lines of code in main.py to enable automatic detection of CSS3 webcolors.

Now, instead of sudo msi-perkeyrgb -s 00ff00 you can simply run sudo msi-perkeyrgb -s green or sudo msi-perkeyrgb -s cornflowerblue or sudo msi-perkeyrgb -s peachpuff or whatever other fancy colors you desire.

The changes use the name_to_hex method from the webcolors module (which has been included in the setup.py as a dependency) to try converting the given -s argument from web color to hex. If it fails (e.g. if it's already a hex color), it will revert back to the original behavior and try to set it as a hex color. If that fails, the same original error will be thrown.

Changes have been tested out locally and there appears to be no errors.

bwu62 avatar May 13 '20 07:05 bwu62

Fixed a minor issue with webcolor code, updated help text, and added random color option.

Color sampled uniformly randomly in HLS space such that

  • 25% <= luminance < 75%
  • 50% <= saturation < 100% so that resulting random color won't be too light or dark or desaturated.

bwu62 avatar May 13 '20 09:05 bwu62

^ Forgot to add an item to the commit message so amended it and force-pushed.

Changes:

  1. Added print out statement to random color feature so user can see the hex color that was randomly generated.
  2. Been using this on my computer (GL73-9SDK-413) for few weeks now and I've had no problems, so I added GL73 to the list of supported devices. It seems to use the same keyboard map as GL63.

bwu62 avatar May 13 '20 11:05 bwu62

Sorry, accidentally hit close button. Request is still open, pending further review or merge.

bwu62 avatar May 17 '20 18:05 bwu62