adafruit / circuitpython

CircuitPython - a Python implementation for teaching coding with microcontrollers
https://circuitpython.org
Other
4.09k stars 1.21k forks source link

displayio.Palette: directly support 'None' to indicate transparent pixels #2632

Open jepler opened 4 years ago

jepler commented 4 years ago

Right now, it's necessary for every class that wants to deal with a color-or-transparent to check for a "None" value and use it to set the palette entry's transparent flag. If "None" was supported by Palette's getitem/setitem in the core C code, then all this using code could be simplified and transparent color would always be available anywhere a numeric color is accepted.

Caveat: this means that displayio now parses a color that neopixel doesn't -- but a transparent neopixel isn't really a thing.

dhalbert commented 4 years ago

@jepler did you want this to be in 5.0.0, or is Long Term?

jepler commented 4 years ago

I wouldn't hold back a release for this, it's a "would be nice" in my opinion.