Advertisement
Guest User

Untitled

a guest
Apr 5th, 2020
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  1. #!/bin/env python
  2.  
  3. import openrazer.client
  4. import json
  5.  
  6. deviceManager = openrazer.client.DeviceManager()
  7. keyboard = deviceManager.devices[0]
  8.  
  9. # Load keymap color profile
  10. with open('keymap.json') as f:
  11.   keys = json.load(f)
  12.  
  13. # Color definitions
  14. color = {
  15.   "RED": [255, 0, 0],
  16.   "ORANGE": [255, 100, 0],
  17.   "BLUE": [0, 0, 255],
  18.   "WHITE": [255, 255, 255],
  19.   "GREEN": [0, 255, 0],
  20.   "YELLOW": [255, 255, 0],
  21.   "CYAN": [0, 255, 255],
  22.   "PINK": [255, 0, 255]
  23. }
  24.  
  25. # Loop through all keys in the map and set the color
  26. for key in keys:
  27.   row = keys[key][0]
  28.   col = keys[key][1]
  29.   hue = keys[key][2]
  30.  
  31.   keyboard.fx.advanced.matrix[row, col] = color[hue]
  32.  
  33. # Draw the settings out to hardware
  34. keyboard.fx.advanced.draw()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement