From 1fbf7198440bb12dffd75d421a07e14f8c5146b3 Mon Sep 17 00:00:00 2001 From: Kattni Rembor Date: Tue, 8 Dec 2020 15:32:46 -0500 Subject: [PATCH] Fix color documentation. --- adafruit_led_animation/color.py | 55 +++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 9 deletions(-) diff --git a/adafruit_led_animation/color.py b/adafruit_led_animation/color.py index 577742a..91d3b34 100644 --- a/adafruit_led_animation/color.py +++ b/adafruit_led_animation/color.py @@ -19,50 +19,87 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -"""Color variables made available for import for CircuitPython LED animations library. +""" +`adafruit_led_animation.color` +================================================================================ + +Color variables assigned to RGB values made available for import. + +* Author(s): Kattni Rembor + +Implementation Notes +-------------------- -RGBW_WHITE_RGB is for RGBW strips to illuminate only the RGB diodes. -RGBW_WHITE_W is for RGBW strips to illuminate only White diode. -RGBW_WHITE_RGBW is for RGBW strips to illuminate the RGB and White diodes. +**Hardware:** -RAINBOW is a list of colors to use for cycling through. +* `Adafruit NeoPixels `_ +* `Adafruit DotStars `_ + +**Software and Dependencies:** + +* Adafruit CircuitPython firmware for the supported boards: + https://circuitpython.org/downloads """ RED = (255, 0, 0) +"""Red.""" YELLOW = (255, 150, 0) +"""Yellow.""" ORANGE = (255, 40, 0) +"""Orange.""" GREEN = (0, 255, 0) +"""Green.""" TEAL = (0, 255, 120) +"""Teal.""" CYAN = (0, 255, 255) +"""Cyan.""" BLUE = (0, 0, 255) +"""Blue.""" PURPLE = (180, 0, 255) +"""Purple.""" MAGENTA = (255, 0, 20) +"""Magenta.""" WHITE = (255, 255, 255) +"""White.""" BLACK = (0, 0, 0) +"""Black or off.""" GOLD = (255, 222, 30) +"""Gold.""" PINK = (242, 90, 255) +"""Pink.""" AQUA = (50, 255, 255) +"""Aqua.""" JADE = (0, 255, 40) +"""Jade.""" AMBER = (255, 100, 0) +"""Amber.""" OLD_LACE = (253, 245, 230) # Warm white. +"""Old lace or warm white.""" RGBW_WHITE_RGB = (255, 255, 255, 0) +"""RGBW_WHITE_RGB is for RGBW strips to illuminate only the RGB diodes.""" RGBW_WHITE_W = (0, 0, 0, 255) +"""RGBW_WHITE_W is for RGBW strips to illuminate only White diode.""" RGBW_WHITE_RGBW = (255, 255, 255, 255) +"""RGBW_WHITE_RGBW is for RGBW strips to illuminate the RGB and White diodes.""" RAINBOW = (RED, ORANGE, YELLOW, GREEN, BLUE, PURPLE) +"""RAINBOW is a list of colors to use for cycling through. +Includes, in order: red, orange, yellow, green, blue, and purple.""" try: try: - # Backwards compat for 5.3.0 and prior + # Backwards compatibility for 5.3.0 and prior from _pixelbuf import colorwheel # pylint: disable=unused-import except ImportError: from _pixelbuf import wheel as colorwheel # pylint: disable=unused-import except ImportError: - # Ensure we have a wheel if not built in + def colorwheel(pos): - """Input a value 0 to 255 to get a color value. - The colours are a transition r - g - b - back to r.""" + """Colorwheel is built into CircuitPython's _pixelbuf. A separate colorwheel is included + here for use with CircuitPython builds that do not include _pixelbuf, as with some of the + SAMD21 builds. To use: input a value 0 to 255 to get a color value. + The colours are a transition from red to green to blue and back to red.""" if pos < 0 or pos > 255: return 0, 0, 0 if pos < 85: