MCPcopy Index your code
hub / github.com/FrameworkComputer/inputmodule-rs / set_color

Function set_color

python/inputmodule/inputmodule/c1minimal.py:12–35  ·  view source on GitHub ↗
(dev, color)

Source from the content-addressed store, hash-verified

10
11
12def set_color(dev, color):
13 rgb = None
14 if color == "white":
15 rgb = [0xFF, 0xFF, 0xFF]
16 elif color == "black":
17 rgb = [0x00, 0x00, 0x00]
18 elif color == "red":
19 rgb = [0xFF, 0x00, 0x00]
20 elif color == "green":
21 rgb = [0x00, 0xFF, 0x00]
22 elif color == "blue":
23 rgb = [0x00, 0x00, 0xFF]
24 elif color == "yellow":
25 rgb = [0xFF, 0xFF, 0x00]
26 elif color == "cyan":
27 rgb = [0x00, 0xFF, 0xFF]
28 elif color == "purple":
29 rgb = [0xFF, 0x00, 0xFF]
30 else:
31 print(f"Unknown color: {color}")
32 return
33
34 if rgb:
35 send_command(dev, CommandVals.SetColor, rgb)

Callers 1

main_cliFunction · 0.90

Calls 1

send_commandFunction · 0.90

Tested by

no test coverage detected