Skip to content

feature: add invert_condition option for inverted rendering of tiles - #79

Merged
cryptomilk merged 1 commit into
cryptomilk:mainfrom
ploebb:invert-condition
Jul 12, 2026
Merged

feature: add invert_condition option for inverted rendering of tiles#79
cryptomilk merged 1 commit into
cryptomilk:mainfrom
ploebb:invert-condition

Conversation

@ploebb

@ploebb ploebb commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Add invert_condition option for inverted rendering of tiles

  • New optional invert_condition on tile widgets. When non-empty and
    all conditions are met, the tile renders inverted (solid black card, white
    text/icon, flat no-circle glyph)
  • Rationale: on grayscale e-ink there's no color to signal "needs attention",
    and the default tinted icon circle reads as lower contrast when active.
  • Reuses the full condition system from the visibility feature. The Visibility
    panel builder was generalized into a shared _buildConditionsPanel().
  • Editor: new "Invert" conditions panel on tile widgets, reusing HA's native
    ha-card-conditions-editor;
  • Fixes a data-loss issue along the way: the ha-form value-changed handler
    drops widget keys ha-form doesn't manage; invert_condition is now
    preserved like visibility and entries.
  • Tests: 11 new pytest cases (test_render_tile.py), 8 new vitest cases
    (editor panel, write-back, preservation). Full suites pass: pytest 1040,
    ruff, ty, interrogate, tsc, vitest 110.

Screenshots

UI

grafik

Condition not met

eink_after

Condition met

eink_invert_test

Tile widgets gain invert_condition — a list of Lovelace card conditions
(same format and evaluator as the visibility field). When non-empty and
all conditions are met, the tile renders as a solid black card with
white text/icon, with the icon forced to the flat no-circle glyph. On
grayscale e-ink panels a full-tile inversion is an unmissable attention
signal, where the default active-state icon tint reads as lower contrast
than the inactive state.

The editor gains an Invert conditions panel on tile widgets, built on
the same ha-card-conditions-editor wrapper as the Visibility panel
(generalized into _buildConditionsPanel). The ha-form value-changed
handler now also preserves invert_condition, which ha-form would
otherwise drop on any edit.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014RdcF9h4rCMcnKeHWMBdrW
@ploebb ploebb changed the title feat(tile): add invert_condition option for inverted attention rendering feature: add invert_condition option for inverted rendering of tiles Jul 12, 2026
@ploebb
ploebb marked this pull request as ready for review July 12, 2026 14:21
@cryptomilk

Copy link
Copy Markdown
Owner

Thank you very much for your contribution. I'm not very happy with the Tile widget yet. I think we need to think about a redesign for eink displays. Where to put icons, labels, values ...

@ploebb

ploebb commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

My pleasure. Thanks for that great integration! Its straight-forward to use and I like the freedom of pixel-accurate placement of elements.

I agree that it's not easy to find a good design-language for epaper. Since we do not have color (usually) I think we need to work with contrast instead if we want to make things pop that need to catch attention at a glance.

Another much simpler option to my full inversion approach: you could just increas the contrast of the "on" state icon. Make it white icon on full a full black circle. This is currently a filled gray circle, which does not provide that much contrast to the white icon and other gray elements on the dashboard. But then again, sometimes you maybe dont want to have that "alert, look at me" look, but only want to show the current state - for which the gray is perfectly fine.

For the PR: any changes you want to see or do you prefer to not merge at all and instead go for a redesign entirely?

@cryptomilk

Copy link
Copy Markdown
Owner

The MR looks fine to me. I will merge it. Just wanted to let you know that I'm open for redesign ideas :-)

I also plan to support color displays in future. reTerminal 1002 is one for example. But first I want to have the grayscale working before adding color support.

@cryptomilk
cryptomilk merged commit 581a040 into cryptomilk:main Jul 12, 2026
8 checks passed
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