def color_wheel(pos): """Generate rainbow colors across 0-255 positions.""" if pos < 85: return Color(pos * 3, 255 - pos * 3, 0) elif pos < 170: pos -= 85 return Color(255 - pos * 3, 0, pos * 3) else: pos -= 170 return Color(0, pos * 3, 255 - pos * 3)
def dim(color, decay): r = (color & 0x00ff0000) >> 16 g = (color & 0x0000ff00) >> 8 b = (color & 0x000000ff) r = 0 if r <= 1 else int(r * decay) g = 0 if g <= 1 else int(g * decay) b = 0 if b <= 1 else int(b * decay) return Color(int(r), int(g), int(b))
def setPixels(img): pos = 0 for row in range(0, img.height): for col in range(0, img.width): if pos >= strip.numPixels(): return c = col if Config.LED['INVERTED_PANEL_ROWS']: if row % 2 == 0: c = 15 - col px = img.getpixel((c, row)) strip.setPixelColor(pos, Color(px[0], px[1], px[2])) pos += 1