PyBadger includes a set of colors available for use in your code. Each color is equivalent to an (r, g, b) value, e.g. RED is equal to (255, 0, 0), and GREEN is equal to (0, 255, 0). Pybadger colors can take the place of anything that expects an (r, g, b) tuple, including controlling the on-board NeoPixel! To use the PyBadger colors, simply include pybadger.COLOR_NAME in your code in place of a color tuple.

For example, to turn the NeoPixel on your CLUE red, you could save the following as code.py:

Download: file
from adafruit_pybadger import pybadger

while True:
	pybadger.pixels.fill(pybadger.RED)

To create the color-block badge background as a white background with a purple rectangle over it, we included the following line in the custom badge code:

Download: file
pybadger.badge_background(background_color=pybadger.WHITE,
                          rectangle_color=pybadger.PURPLE,
                          rectangle_drop=0.2, rectangle_height=0.6)

PyBadger makes a variety of colors super simple to use!

The colors available in PyBadger are:

  • RED
  • YELLOW
  • ORANGE
  • GREEN, TEAL
  • CYAN, BLUE
  • PURPLE
  • MAGENTA
  • WHITE
  • BLACK
  • GOLD
  • PINK
  • AQUA
  • JADE
  • AMBER
  • VIOLET
  • SKY
  • DEEP_PURPLE
  • PYTHON_YELLOW
  • PYTHON_BLUE
  • BLINKA_PURPLE
  • BLINKA_PINK

This guide was first published on Mar 04, 2020. It was last updated on Mar 04, 2020.

This page (PyBadger Colors) was last updated on Mar 26, 2021.

Text editor powered by tinymce.