The color.py file in adafruit_led_animation is missing some colors. Attached is a possible replacement.
All your original colors are preserved.
Matching color names start with NEW_ for those with different tupples.
Matching color names where the tupples are the same are commented out (#) in the added colors.
There are over 145 colors in the replacement file.
I have included your comments and code outside of the colors. I am running it.
I claim no license for my addition to your code.
Why is C o n f l i c t i n g a banned word?
Bruce
Code: Select all
# SPDX-FileCopyrightText: 2019 Kattni Rembor for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
`adafruit_led_animation.color`
================================================================================
Color variables assigned to RGB values made available for import.
* Author(s): Kattni Rembor
Implementation Notes
--------------------
**Hardware:**
* `Adafruit NeoPixels <https://www.adafruit.com/category/168>`_
* `Adafruit DotStars <https://www.adafruit.com/category/885>`_
**Software and Dependencies:**
* Adafruit CircuitPython firmware for the supported boards:
https://circuitpython.org/downloads
"""
MAROON = (128,0,0)
DARK_RED = (139,0,0)
BROWN = (165,42,42)
FIREBRICK = (178,34,34)
CRIMSON = (220,20,60)
#RED = (255,0,0)
TOMATO = (255,99,71)
CORAL = (255,127,80)
LIGHT_CORAL = (240,128,128)
DARK_SALMON = (233,150,122)
SALMON = (250,128,114)
LIGHT_SALMON = (255,160,122)
ORANGE_RED = (255,69,0)
DARK_ORANGE = (255,140,0)
NEW_ORANGE = (255,165,0)
NEW_GOLD = (255,215,0)
DARK_GOLDEN_ROD = (184,134,11)
GOLDEN_ROD = (218,165,32)
PALE_GOLDEN_ROD = (238,232,170)
DARK_KHAKI = (189,183,107)
KHAKI = (240,230,140)
OLIVE = (128,128,0)
NEW_YELLOW = (255,255,0)
YELLOW_GREEN = (154,205,50)
DARK_OLIVE_GREEN = (85,107,47)
OLIVE_DRAB = (107,142,35)
LAWN_GREEN = (124,252,0)
CHART_REUSE = (127,255,0)
GREEN_YELLOW = (173,255,47)
DARK_GREEN = (0,100,0)
GREEN = (0,128,0)
FOREST_GREEN = (34,139,34)
LIME = (0,255,0)
LIME_GREEN = (50,205,50)
LIGHT_GREEN = (144,238,144)
PALE_GREEN = (152,251,152)
DARK_SEA_GREEN = (143,188,143)
MEDIUM_SPRING_GREEN = (0,250,154)
SPRING_GREEN = (0,255,127)
SEA_GREEN = (46,139,87)
MEDIUM_AQUA_MARINE = (102,205,170)
MEDIUM_SEA_GREEN = (60,179,113)
LIGHT_SEA_GREEN = (32,178,170)
DARK_SLATE_GRAY = (47,79,79)
NEW_TEAL = (0,128,128)
DARK_CYAN = (0,139,139)
NEW_AQUA = (0,255,255)
#CYAN = (0,255,255)
LIGHT_CYAN = (224,255,255)
DARK_TURQUOISE = (0,206,209)
TURQUOISE = (64,224,208)
MEDIUM_TURQUOISE = (72,209,204)
PALE_TURQUOISE = (175,238,238)
AQUA_MARINE = (127,255,212)
POWDER_BLUE = (176,224,230)
CADET_BLUE = (95,158,160)
STEEL_BLUE = (70,130,180)
CORN_FLOWER_BLUE = (100,149,237)
DEEP_SKY_BLUE = (0,191,255)
DODGER_BLUE = (30,144,255)
LIGHT_BLUE = (173,216,230)
SKY_BLUE = (135,206,235)
LIGHT_SKY_BLUE = (135,206,250)
MIDNIGHT_BLUE = (25,25,112)
NAVY = (0,0,128)
DARK_BLUE = (0,0,139)
MEDIUM_BLUE = (0,0,205)
#BLUE = (0,0,255)
ROYAL_BLUE = (65,105,225)
BLUE_VIOLET = (138,43,226)
INDIGO = (75,0,130)
DARK_SLATE_BLUE = (72,61,139)
SLATE_BLUE = (106,90,205)
MEDIUM_SLATE_BLUE = (123,104,238)
MEDIUM_PURPLE = (147,112,219)
DARK_MAGENTA = (139,0,139)
DARK_VIOLET = (148,0,211)
DARK_ORCHID = (153,50,204)
MEDIUM_ORCHID = (186,85,211)
NEW_PURPLE = (128,0,128)
THISTLE = (216,191,216)
PLUM = (221,160,221)
VIOLET = (238,130,238)
FUCHSIA = (255,0,255)
NEW_MAGENTA = (255,0,255)
ORCHID = (218,112,214)
MEDIUM_VIOLET_RED = (199,21,133)
PALE_VIOLET_RED = (219,112,147)
DEEP_PINK = (255,20,147)
HOT_PINK = (255,105,180)
LIGHT_PINK = (255,182,193)
NEW_PINK = (255,192,203)
ANTIQUE_WHITE = (250,235,215)
BEIGE = (245,245,220)
BISQUE = (255,228,196)
WHEAT = (245,222,179)
CORN_SILK = (255,248,220)
LEMON_CHIFFON = (255,250,205)
LIGHT_GOLDEN_ROD_YELLOW = (250,250,210)
LIGHT_YELLOW = (255,255,224)
SADDLE_BROWN = (139,69,19)
SIENNA = (160,82,45)
CHOCOLATE = (210,105,30)
PERU = (205,133,63)
SANDY_BROWN = (244,164,96)
BURLY_WOOD = (222,184,135)
TAN = (210,180,140)
ROSY_BROWN = (188,143,143)
MOCCASIN = (255,228,181)
NAVAJO_WHITE = (255,222,173)
PEACH_PUFF = (255,218,185)
MISTY_ROSE = (255,228,225)
LAVENDER_BLUSH = (255,240,245)
LINEN = (250,240,230)
#OLD_LACE = (253,245,230)
PAPAYA_WHIP = (255,239,213)
SEA_SHELL = (255,245,238)
MINT_CREAM = (245,255,250)
SLATE_GRAY = (112,128,144)
LIGHT_SLATE_GRAY = (119,136,153)
LIGHT_STEEL_BLUE = (176,196,222)
LAVENDER = (230,230,250)
FLORAL_WHITE = (255,250,240)
ALICE_BLUE = (240,248,255)
GHOST_WHITE = (248,248,255)
HONEYDEW = (240,255,240)
IVORY = (255,255,240)
AZURE = (240,255,255)
SNOW = (255,250,250)
#BLACK = (0,0,0)
DIM_GREY = (105,105,105)
DIM_GRAY = (105,105,105)
GREY = (128,128,128)
GRAY = (128,128,128)
DARK_GREY = (169,169,169)
DARK_GRAY = (169,169,169)
SILVER = (192,192,192)
LIGHT_GREY = (211,211,211)
LIGHT_GRAY = (211,211,211)
GAINSBORO = (220,220,220)
WHITE_SMOKE = (245,245,245)
WARM_WHITE = (253, 245, 230)
#WHITE = (255,255,255)
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)
"""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 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:
def colorwheel(pos):
"""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:
return int(255 - pos * 3), int(pos * 3), 0
if pos < 170:
pos -= 85
return 0, int(255 - pos * 3), int(pos * 3)
pos -= 170
return int(pos * 3), 0, int(255 - (pos * 3))
def calculate_intensity(color, intensity=1.0):
"""
Takes a RGB[W] color tuple and adjusts the intensity.
:param float intensity:
:param color: color value (tuple, list or int)
:return: color
"""
# Note: This code intentionally avoids list comprehensions and intermediate variables
# for an approximately 2x performance gain.
if isinstance(color, int):
return (
(int((color & 0xFF0000) * intensity) & 0xFF0000)
| (int((color & 0xFF00) * intensity) & 0xFF00)
| (int((color & 0xFF) * intensity) & 0xFF)
)
if len(color) == 3:
return (
int(color[0] * intensity),
int(color[1] * intensity),
int(color[2] * intensity),
)
if len(color) == 4 and isinstance(color[3], float):
return (
int(color[0] * intensity),
int(color[1] * intensity),
int(color[2] * intensity),
color[3],
)
return (
int(color[0] * intensity),
int(color[1] * intensity),
int(color[2] * intensity),
int(color[3] * intensity),
)