File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -31,12 +31,15 @@ for setting a device to a rainbow color.
3131.. code-block :: python
3232
3333 from openrgb import OpenRGBClient
34- from openrgb.utils import RGBColor
34+ from openrgb.utils import RGBColor, ZoneType
3535
3636 cli = OpenRGBClient()
3737
38- # dividing the color spectrum by number of LEDs
39- step = int (len (cli.ee_devices[0 ].colors)/ 360 )
38+ # finding a linear zone
39+ zone = next (z for dev in cli.ee_devices for z in dev.zones if z.type == ZoneType.LINEAR )
40+ # dividing the color spectrum by number of LEDs in the zone
41+ step = int (360 / len (zone.colors))
42+ # Setting the zones colors to the entire spectrum of the rainbow
4043 for i, hue in enumerate (range (0 , 360 , step)):
41- cli.ee_devices[ 0 ] .colors[i] = RGBColor.fromHSV(hue, 100 , 100 )
42- cli.ee_devices[ 0 ] .show()
44+ zone .colors[i] = RGBColor.fromHSV(hue, 100 , 100 )
45+ zone .show()
You can’t perform that action at this time.
0 commit comments