Skip to content

Commit 8550523

Browse files
committed
updated basic effects example in docs
1 parent 6e048c4 commit 8550523

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

docs/pages/effects.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff 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()

0 commit comments

Comments
 (0)