Skip to content

Add theme-aware colour helpers to the display core - #2754

Open
vnxdtzip wants to merge 1 commit into
BruceDevices:devfrom
vnxdtzip:ui/color-helpers
Open

Add theme-aware colour helpers to the display core#2754
vnxdtzip wants to merge 1 commit into
BruceDevices:devfrom
vnxdtzip:ui/color-helpers

Conversation

@vnxdtzip

@vnxdtzip vnxdtzip commented Aug 4, 2026

Copy link
Copy Markdown

Proposed Changes

A module that needs a dimmed or highlighted shade of the active theme has no
way to ask for one. The only helper available, getColorVariation, steps
brightness up or down and cannot mix toward another colour, so modules fall
back to a fixed constant such as TFT_DARKGREY or TFT_WHITE. That is the root
cause of most of the screens in Bruce that stop following the user's theme as
soon as they need more than the primary colour.

This adds two helpers next to it in core/display:

blendColors(a, b, t) linear RGB565 mix; t = 0 keeps a, t = 255 keeps b
buildHeatPalette(lut, n) fills a lookup table with a theme ramp running
from the background up to a brightened primary,
for waterfalls and other intensity plots

Both are pure additions. No existing function is modified, and nothing calls
them in this PR - the modules that consume them follow separately.

Types of Changes

New Feature (internal helper API). No behaviour change and no breaking change.

Verification

Nothing on screen changes from this PR alone, so verification is limited to
confirming the build is clean and that only insertions were made:

pio run -e m5stack-cardputer
git show --stat   # 2 files changed, 31 insertions(+), 0 deletions(-)

Testing

Bruce has no unit test harness covering the display layer, so this was
verified by compiling for m5stack-cardputer on this branch. The helpers get
exercised on hardware through the follow-up PRs that use them.

Linked Issues

None. This is the base commit of a series that standardises the
spectrum-style screens; the module PRs listed below depend on it.

User-Facing Change

NONE

Further Comments

Prerequisite for ui/spectrum-view, ui/rf-waterfall-theme and
ui/rf-spectrum-theme.

#### Proposed Changes ####

A module that needs a dimmed or highlighted shade of the active theme has no
way to ask for one. The only helper available, getColorVariation, steps
brightness up or down and cannot mix toward another colour, so modules fall
back to a fixed constant such as TFT_DARKGREY or TFT_WHITE. That is the root
cause of most of the screens in Bruce that stop following the user's theme as
soon as they need more than the primary colour.

This adds two helpers next to it in core/display:

  blendColors(a, b, t)      linear RGB565 mix; t = 0 keeps a, t = 255 keeps b
  buildHeatPalette(lut, n)  fills a lookup table with a theme ramp running
                            from the background up to a brightened primary,
                            for waterfalls and other intensity plots

Both are pure additions. No existing function is modified, and nothing calls
them in this PR - the modules that consume them follow separately.

#### Types of Changes ####

New Feature (internal helper API). No behaviour change and no breaking change.

#### Verification ####

Nothing on screen changes from this PR alone, so verification is limited to
confirming the build is clean and that only insertions were made:

    pio run -e m5stack-cardputer
    git show --stat   # 2 files changed, 31 insertions(+), 0 deletions(-)

#### Testing ####

Bruce has no unit test harness covering the display layer, so this was
verified by compiling for m5stack-cardputer on this branch. The helpers get
exercised on hardware through the follow-up PRs that use them.

#### Linked Issues ####

None. This is the base commit of a series that standardises the
spectrum-style screens; the module PRs listed below depend on it.

#### User-Facing Change ####
```release-note
NONE
```

#### Further Comments ####

Prerequisite for ui/spectrum-view, ui/rf-waterfall-theme and
ui/rf-spectrum-theme.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants