|
19 | 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 | 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21 | 21 | # THE SOFTWARE.
|
22 |
| -"""Color variables made available for import for CircuitPython LED animations library. |
| 22 | +""" |
| 23 | +`adafruit_led_animation.color` |
| 24 | +================================================================================ |
| 25 | +
|
| 26 | +Color variables assigned to RGB values made available for import. |
| 27 | +
|
| 28 | +* Author(s): Kattni Rembor |
| 29 | +
|
| 30 | +Implementation Notes |
| 31 | +-------------------- |
23 | 32 |
|
24 |
| -RGBW_WHITE_RGB is for RGBW strips to illuminate only the RGB diodes. |
25 |
| -RGBW_WHITE_W is for RGBW strips to illuminate only White diode. |
26 |
| -RGBW_WHITE_RGBW is for RGBW strips to illuminate the RGB and White diodes. |
| 33 | +**Hardware:** |
27 | 34 |
|
28 |
| -RAINBOW is a list of colors to use for cycling through. |
| 35 | +* `Adafruit NeoPixels <https://www.adafruit.com/category/168>`_ |
| 36 | +* `Adafruit DotStars <https://www.adafruit.com/category/885>`_ |
| 37 | +
|
| 38 | +**Software and Dependencies:** |
| 39 | +
|
| 40 | +* Adafruit CircuitPython firmware for the supported boards: |
| 41 | + https://circuitpython.org/downloads |
29 | 42 | """
|
30 | 43 | RED = (255, 0, 0)
|
| 44 | +"""Red.""" |
31 | 45 | YELLOW = (255, 150, 0)
|
| 46 | +"""Yellow.""" |
32 | 47 | ORANGE = (255, 40, 0)
|
| 48 | +"""Orange.""" |
33 | 49 | GREEN = (0, 255, 0)
|
| 50 | +"""Green.""" |
34 | 51 | TEAL = (0, 255, 120)
|
| 52 | +"""Teal.""" |
35 | 53 | CYAN = (0, 255, 255)
|
| 54 | +"""Cyan.""" |
36 | 55 | BLUE = (0, 0, 255)
|
| 56 | +"""Blue.""" |
37 | 57 | PURPLE = (180, 0, 255)
|
| 58 | +"""Purple.""" |
38 | 59 | MAGENTA = (255, 0, 20)
|
| 60 | +"""Magenta.""" |
39 | 61 | WHITE = (255, 255, 255)
|
| 62 | +"""White.""" |
40 | 63 | BLACK = (0, 0, 0)
|
| 64 | +"""Black or off.""" |
41 | 65 |
|
42 | 66 | GOLD = (255, 222, 30)
|
| 67 | +"""Gold.""" |
43 | 68 | PINK = (242, 90, 255)
|
| 69 | +"""Pink.""" |
44 | 70 | AQUA = (50, 255, 255)
|
| 71 | +"""Aqua.""" |
45 | 72 | JADE = (0, 255, 40)
|
| 73 | +"""Jade.""" |
46 | 74 | AMBER = (255, 100, 0)
|
| 75 | +"""Amber.""" |
47 | 76 | OLD_LACE = (253, 245, 230) # Warm white.
|
| 77 | +"""Old lace or warm white.""" |
48 | 78 |
|
49 | 79 | RGBW_WHITE_RGB = (255, 255, 255, 0)
|
| 80 | +"""RGBW_WHITE_RGB is for RGBW strips to illuminate only the RGB diodes.""" |
50 | 81 | RGBW_WHITE_W = (0, 0, 0, 255)
|
| 82 | +"""RGBW_WHITE_W is for RGBW strips to illuminate only White diode.""" |
51 | 83 | RGBW_WHITE_RGBW = (255, 255, 255, 255)
|
| 84 | +"""RGBW_WHITE_RGBW is for RGBW strips to illuminate the RGB and White diodes.""" |
52 | 85 |
|
53 | 86 | RAINBOW = (RED, ORANGE, YELLOW, GREEN, BLUE, PURPLE)
|
| 87 | +"""RAINBOW is a list of colors to use for cycling through. |
| 88 | +Includes, in order: red, orange, yellow, green, blue, and purple.""" |
54 | 89 |
|
55 | 90 | try:
|
56 | 91 | try:
|
57 |
| - # Backwards compat for 5.3.0 and prior |
| 92 | + # Backwards compatibility for 5.3.0 and prior |
58 | 93 | from _pixelbuf import colorwheel # pylint: disable=unused-import
|
59 | 94 | except ImportError:
|
60 | 95 | from _pixelbuf import wheel as colorwheel # pylint: disable=unused-import
|
61 | 96 | except ImportError:
|
62 |
| - # Ensure we have a wheel if not built in |
| 97 | + |
63 | 98 | def colorwheel(pos):
|
64 |
| - """Input a value 0 to 255 to get a color value. |
65 |
| - The colours are a transition r - g - b - back to r.""" |
| 99 | + """Colorwheel is built into CircuitPython's _pixelbuf. A separate colorwheel is included |
| 100 | + here for use with CircuitPython builds that do not include _pixelbuf, as with some of the |
| 101 | + SAMD21 builds. To use: input a value 0 to 255 to get a color value. |
| 102 | + The colours are a transition from red to green to blue and back to red.""" |
66 | 103 | if pos < 0 or pos > 255:
|
67 | 104 | return 0, 0, 0
|
68 | 105 | if pos < 85:
|
|
0 commit comments