Fix color documentation.
This commit is contained in:
parent
ba976f20bc
commit
1fbf719844
1 changed files with 46 additions and 9 deletions
|
|
@ -19,50 +19,87 @@
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
# 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
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
# THE SOFTWARE.
|
# THE SOFTWARE.
|
||||||
"""Color variables made available for import for CircuitPython LED animations library.
|
"""
|
||||||
|
`adafruit_led_animation.color`
|
||||||
|
================================================================================
|
||||||
|
|
||||||
RGBW_WHITE_RGB is for RGBW strips to illuminate only the RGB diodes.
|
Color variables assigned to RGB values made available for import.
|
||||||
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.
|
|
||||||
|
|
||||||
RAINBOW is a list of colors to use for cycling through.
|
* 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
|
||||||
"""
|
"""
|
||||||
RED = (255, 0, 0)
|
RED = (255, 0, 0)
|
||||||
|
"""Red."""
|
||||||
YELLOW = (255, 150, 0)
|
YELLOW = (255, 150, 0)
|
||||||
|
"""Yellow."""
|
||||||
ORANGE = (255, 40, 0)
|
ORANGE = (255, 40, 0)
|
||||||
|
"""Orange."""
|
||||||
GREEN = (0, 255, 0)
|
GREEN = (0, 255, 0)
|
||||||
|
"""Green."""
|
||||||
TEAL = (0, 255, 120)
|
TEAL = (0, 255, 120)
|
||||||
|
"""Teal."""
|
||||||
CYAN = (0, 255, 255)
|
CYAN = (0, 255, 255)
|
||||||
|
"""Cyan."""
|
||||||
BLUE = (0, 0, 255)
|
BLUE = (0, 0, 255)
|
||||||
|
"""Blue."""
|
||||||
PURPLE = (180, 0, 255)
|
PURPLE = (180, 0, 255)
|
||||||
|
"""Purple."""
|
||||||
MAGENTA = (255, 0, 20)
|
MAGENTA = (255, 0, 20)
|
||||||
|
"""Magenta."""
|
||||||
WHITE = (255, 255, 255)
|
WHITE = (255, 255, 255)
|
||||||
|
"""White."""
|
||||||
BLACK = (0, 0, 0)
|
BLACK = (0, 0, 0)
|
||||||
|
"""Black or off."""
|
||||||
|
|
||||||
GOLD = (255, 222, 30)
|
GOLD = (255, 222, 30)
|
||||||
|
"""Gold."""
|
||||||
PINK = (242, 90, 255)
|
PINK = (242, 90, 255)
|
||||||
|
"""Pink."""
|
||||||
AQUA = (50, 255, 255)
|
AQUA = (50, 255, 255)
|
||||||
|
"""Aqua."""
|
||||||
JADE = (0, 255, 40)
|
JADE = (0, 255, 40)
|
||||||
|
"""Jade."""
|
||||||
AMBER = (255, 100, 0)
|
AMBER = (255, 100, 0)
|
||||||
|
"""Amber."""
|
||||||
OLD_LACE = (253, 245, 230) # Warm white.
|
OLD_LACE = (253, 245, 230) # Warm white.
|
||||||
|
"""Old lace or warm white."""
|
||||||
|
|
||||||
RGBW_WHITE_RGB = (255, 255, 255, 0)
|
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 = (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 = (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 = (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:
|
||||||
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
|
from _pixelbuf import colorwheel # pylint: disable=unused-import
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from _pixelbuf import wheel as colorwheel # pylint: disable=unused-import
|
from _pixelbuf import wheel as colorwheel # pylint: disable=unused-import
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# Ensure we have a wheel if not built in
|
|
||||||
def colorwheel(pos):
|
def colorwheel(pos):
|
||||||
"""Input a value 0 to 255 to get a color value.
|
"""Colorwheel is built into CircuitPython's _pixelbuf. A separate colorwheel is included
|
||||||
The colours are a transition r - g - b - back to r."""
|
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:
|
if pos < 0 or pos > 255:
|
||||||
return 0, 0, 0
|
return 0, 0, 0
|
||||||
if pos < 85:
|
if pos < 85:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue