palettes
๐ Color Wheels
Generate continuous color ramps and rainbow gradients with configurable saturation and hue lengths.
๐ฏ Material Design
Access standardized semantic UI palettes with shades from 50 to 900 for modern themes and widgets.
๐ง Color Cubes
Evenly distributed 8, 27, 64, and 125 color spaces optimized for dithering and quantized graphics.
๐ Byte-Swapping
First-class 16-bit RGB565 byte swapping (swapped=True) for direct SPI panel compatibility.
๐ Quick Install
Copy the palettes/ folder from the repository into your board's CIRCUITPY/lib/ folder.
In PyScript headers or Pyodide configurations, declare:
import micropip
await micropip.install(
"pydevices-palettes", index_urls="https://test.pypi.org/simple/"
)
from palettes import get_palette
The wheel is named pydevices-palettes; the module you import is
palettes. On MicroPython the MIP package name is palettes
(mip.install("palettes", index="https://PyDevices.github.io/mip")).
๐ป Live Interactive Demo
Try tweaking the palette parameters below. Click โถ Run to execute the code with direct MicroPython WebAssembly:
๐ Practical Usage Pattern
Construct a palette once and index it inside your application draw loop:
from palettes import get_palette
# Match the display's native color depth (16-bit RGB565)
palette = get_palette(name="wheel", color_depth=16, length=256, saturation=1.0)
# Index directly into the palette
for i in range(16):
display_drv.fill_rect(0, i * 8, 80, 8, palette[i * 16])
If the physical display expects byte-swapped 16-bit values (common on SPI TFTs like the ST7789 or ILI9341), pass swapped=True:
๐ฎ Featured Browser Demos
Explore full-color gradient and animation applications built with palettes:
๐จ Palettes Gallery Showcase
Interactive color visualizer exploring Material Design tokens, HSV wheels, and RGB cubes.
๐ชถ Rainbow Feathers
Geometric generative art rendering smooth multi-chromatic feather curves.
๐ Palette Rotations
Real-time palette cycling and rotational sweeps demonstrating zero-cost animations.
๐ Gradient Scrolling
Hardware vertical scrolling demonstration paired with high-precision palette shading.
๐ Documentation Map
- ๐จ Palette Gallery โ Visual previews and tables for Wheel, Material Design, Cube, and Win16 palettes.
- ๐ข Color Math & Formats โ RGB565 bit-packing, endianness swapping, and HSL/HSV math.
- ๐งฉ Integrations โ Recipes for
pygraphics,pdwidgets, and hardware display drivers. - ๐ API Reference โ Complete docstrings and class references.