Skip to content

Commit 24b1897

Browse files
authored
Merge pull request #82 from adafruit/rainbowio
Updating to use rainbowio.
2 parents 100254a + 1f17980 commit 24b1897

File tree

4 files changed

+6
-26
lines changed

4 files changed

+6
-26
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ repos:
3030
name: pylint (examples code)
3131
description: Run pylint rules on "examples/*.py" files
3232
entry: /usr/bin/env bash -c
33-
args: ['([[ ! -d "examples" ]] || for example in $(find . -path "./examples/*.py"); do pylint --disable=missing-docstring,invalid-name $example; done)']
33+
args: ['([[ ! -d "examples" ]] || for example in $(find . -path "./examples/*.py"); do pylint --disable=missing-docstring,invalid-name,consider-using-f-string $example; done)']
3434
language: system

adafruit_led_animation/animation/rainbowchase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class RainbowChase(Chase):
4040
:param size: Number of pixels to turn on in a row.
4141
:param spacing: Number of pixels to turn off in a row.
4242
:param reverse: Reverse direction of movement.
43-
:param step: How many colors to skip in `colorwheel` per bar (default 8)
43+
:param step: How many colors to skip in ``colorwheel`` per bar (default 8)
4444
"""
4545

4646
# pylint: disable=too-many-arguments

adafruit_led_animation/color.py

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
* Adafruit CircuitPython firmware for the supported boards:
2424
https://circuitpython.org/downloads
2525
"""
26+
# Makes colorwheel() available.
27+
from rainbowio import colorwheel # pylint: disable=unused-import
28+
2629
RED = (255, 0, 0)
2730
"""Red."""
2831
YELLOW = (255, 150, 0)
@@ -70,29 +73,6 @@
7073
"""RAINBOW is a list of colors to use for cycling through.
7174
Includes, in order: red, orange, yellow, green, blue, and purple."""
7275

73-
try:
74-
try:
75-
# Backwards compatibility for 5.3.0 and prior
76-
from _pixelbuf import colorwheel # pylint: disable=unused-import
77-
except ImportError:
78-
from _pixelbuf import wheel as colorwheel # pylint: disable=unused-import
79-
except ImportError:
80-
81-
def colorwheel(pos):
82-
"""Colorwheel is built into CircuitPython's _pixelbuf. A separate colorwheel is included
83-
here for use with CircuitPython builds that do not include _pixelbuf, as with some of the
84-
SAMD21 builds. To use: input a value 0 to 255 to get a color value.
85-
The colours are a transition from red to green to blue and back to red."""
86-
if pos < 0 or pos > 255:
87-
return 0, 0, 0
88-
if pos < 85:
89-
return int(255 - pos * 3), int(pos * 3), 0
90-
if pos < 170:
91-
pos -= 85
92-
return 0, int(255 - pos * 3), int(pos * 3)
93-
pos -= 170
94-
return int(pos * 3), 0, int(255 - (pos * 3))
95-
9676

9777
def calculate_intensity(color, intensity=1.0):
9878
"""

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# Uncomment the below if you use native CircuitPython modules such as
2626
# digitalio, micropython and busio. List the modules you use. Without it, the
2727
# autodoc module docs will fail to generate with a warning.
28-
autodoc_mock_imports = []
28+
autodoc_mock_imports = ["rainbowio"]
2929

3030

3131
intersphinx_mapping = {

0 commit comments

Comments
 (0)