Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/env python
- import openrazer.client
- import json
- deviceManager = openrazer.client.DeviceManager()
- keyboard = deviceManager.devices[0]
- # Load keymap color profile
- with open('keymap.json') as f:
- keys = json.load(f)
- # Color definitions
- color = {
- "RED": [255, 0, 0],
- "ORANGE": [255, 100, 0],
- "BLUE": [0, 0, 255],
- "WHITE": [255, 255, 255],
- "GREEN": [0, 255, 0],
- "YELLOW": [255, 255, 0],
- "CYAN": [0, 255, 255],
- "PINK": [255, 0, 255]
- }
- # Loop through all keys in the map and set the color
- for key in keys:
- row = keys[key][0]
- col = keys[key][1]
- hue = keys[key][2]
- keyboard.fx.advanced.matrix[row, col] = color[hue]
- # Draw the settings out to hardware
- keyboard.fx.advanced.draw()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement