Metadata-Version: 2.4
Name: omnipython-palettes
Version: 0.1.0
Summary: Pure-Python color palette toolkit for OmniPython
Author: Brad Barnett
License-Expression: MIT
Project-URL: Homepage, https://github.com/PyDevices/omnipython/tree/main/palettes
Project-URL: Issues, https://github.com/PyDevices/omnipython/issues
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

![A color wheel above the sixteen Windows colors and ten shades of Material amber](docs/images/palettes.png)

# palettes

palettes is the part of OmniPython that turns a palette index into a color a
display, LED or terminal can use: wheels, cubes, Material Design swatches and
the sixteen Windows names, with the same code on MicroPython-compatible boards,
CircuitPython-compatible boards and CPython. It has no dependencies.

```bash
pip install --pre omnipython-palettes
```

```python
import omip
omip.install("palettes")
```

`omip` comes with OmniPython firmware. On other MicroPython firmware, run
`mip.install("github:PyDevices/omnipython/lib/omip.py")` once to put it on the board.

```python
from palettes import get_palette

# A 360-step color wheel, ready to write to an RGB565 display
wheel = get_palette(name="wheel", length=360, color_depth=16)
print("red, green, blue as RGB565: 0x%04X 0x%04X 0x%04X" % (wheel[0], wheel[120], wheel[240]))

# Named colors, by attribute
win16 = get_palette(name="default", color_depth=24)
print("RED is 0x%06X, and its name back again is %r" % (win16.RED, win16.color_name(12)))

# Material Design, 0xRRGGBB
md = get_palette(name="material_design", color_depth=24)
print("Amber 500 is 0x%06X" % md.AMBER_S500)
```

```text
red, green, blue as RGB565: 0xF800 0x07E0 0x001F
RED is 0xFF0000, and its name back again is 'Red'
Amber 500 is 0xFFC107
```

The picture at the top of this page is those three palettes drawn as bands: the
wheel, the sixteen Windows names and the Amber ramp.

[Docs](https://docs.omnipython.org/en/latest/palettes/) · [Examples](https://gallery.omnipython.org/pyscript/) · [Roadmap](ROADMAP.md)

OmniPython is made by [PyDevices](https://pydevices.com).
