Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added css3 webcolor support for steady colors & random color option #34

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

bwu62
Copy link

@bwu62 bwu62 commented May 13, 2020

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 bwu62 changed the title Added css3 webcolor support for steady colors Added css3 webcolor support for steady colors & random color option May 13, 2020
@bwu62
Copy link
Author

bwu62 commented May 13, 2020

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
Copy link
Author

bwu62 commented May 13, 2020

^ 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 bwu62 closed this May 17, 2020
@bwu62 bwu62 reopened this May 17, 2020
@bwu62
Copy link
Author

bwu62 commented May 17, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants