Skip to content

Transparency setting for shape fill color cannot be dynamically changed after initialization #2076

Closed
@jpecor

Description

@jpecor

I ran into some issues trying to switch between transparent and colored fills for some buttons I was using in a recent project.

Once a shape is created with either fill=<SOME_COLOR> or fill=None, the shape will act as either a filled OR transparent shape and cannot be changed.

The issue appears to be related to the Palette core module in displayio, and the symptoms show up in Adafruit_Display_Shapes as well as Adafruit_Display_Buttons.

It seems like the intent is to allow shapes to change from a solid color fill to transparent and vice-versa, but it doesn't work.

I created a short program that provides a simple demo/test that shows the failure. By selecting whether or not the starting fill is a color (solid, opaque color) or None (transparent), the related failure can be seen.

The test is here:
https://github.com/jpecor/circuitpython_stuff/blob/master/fill_color_none_test.py

In the test, if the starting shape starts with a color, the program will cycle through a few different colors and then attempt to make the shape transparent which will not work.

If the starting shape is transparent (fill=None), the program will again cycle through different colors which will have NO effect as expected, but then it will attempt to change the body color to an actual fill color. This should work, but it does not.

I believe the bug itself is buried somewhere in the Palette module of displayio, but I don't fully understand how the core all stitches together or works at this point.

Maybe someone with more experience can have a look?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions