Skip to content

Preserve color_palette values#236

Merged
FoamyGuy merged 2 commits intoadafruit:mainfrom
FoamyGuy:color_palette_values
Feb 24, 2026
Merged

Preserve color_palette values#236
FoamyGuy merged 2 commits intoadafruit:mainfrom
FoamyGuy:color_palette_values

Conversation

@FoamyGuy
Copy link
Copy Markdown
Contributor

color and background_color arguments were overriding the values that were present in 0 and 1 indexes of color_palette. The API was kind of designed around end users not putting colors into indexes 0-2 of the color_palette that is passed to label init and instead using color, background_color and outline_color arguments.

Now I am working on anti-aliased font rendering and I want the entire color_palette to remain exactly how it was when created so that it will line up correctly with the color indexes used in the font glyph bitmaps.

In hindsight I think it better to change it so that color_palette essentially "overrides" the other arguments color, background_color and outline_color. With the idea being that user code that is passing in a customized color_palette is doing so in order to retain complete custom control over the palette so BitmapLabel should not alter the values during init.

I've updated the two examples that use color_palette to reflect the new behavior of defining all colors in the custom palette and removing usage of the other arguments. There is also 1 instance in the learn repo of code that uses color_palette that I will submit a PR to update as well.

Copy link
Copy Markdown
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Need a major version bump?

@FoamyGuy FoamyGuy requested a review from a team February 24, 2026 17:48
@FoamyGuy
Copy link
Copy Markdown
Contributor Author

Yeah, it is technically breaking the old behavior. Will bump major version.

@FoamyGuy FoamyGuy merged commit 3b606a7 into adafruit:main Feb 24, 2026
1 check passed
adafruit-adabot pushed a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Feb 25, 2026
Updating https://github.com/adafruit/Adafruit_CircuitPython_Bitmap_Font to 2.4.0 from 2.3.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_Bitmap_Font#74 from FoamyGuy/lvfont_support_higher_bpp

Updating https://github.com/adafruit/Adafruit_CircuitPython_Display_Text to 5.0.0 from 4.0.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_Display_Text#236 from FoamyGuy/color_palette_values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants