From b653ee18dc1dfb3b011d601dabbd9b270d63947f Mon Sep 17 00:00:00 2001 From: Misiu Date: Thu, 27 Aug 2026 07:52:10 +0200 Subject: [PATCH 1/2] Add display themes and responsive typography --- ARCHITECTURE.md | 6 ++ CHANGELOG.md | 7 ++ WIDGET_CONTRACT.md | 6 ++ .../opendisplay_studio/composer.py | 22 +++++- custom_components/opendisplay_studio/const.py | 2 +- .../frontend/opendisplay-studio.js | 49 ++++++++++++- .../opendisplay_studio/manifest.json | 2 +- .../opendisplay_studio/projects.py | 15 ++++ .../widgets/weather/widget.liquid | 73 ++++++++++++++++++- .../widgets/weather/widget.yml | 2 +- frontend-src/package-lock.json | 4 +- frontend-src/package.json | 2 +- frontend-src/src/dev.ts | 3 + frontend-src/src/odx-app.ts | 43 ++++++++++- frontend-src/src/services/storage.test.ts | 10 ++- frontend-src/src/services/storage.ts | 3 + frontend-src/src/types.ts | 6 ++ .../src/weather-liquid-contract.test.ts | 9 +++ pyproject.toml | 2 +- tests/test_brand.py | 18 +++++ tests/test_composer.py | 20 +++++ tests/test_projects.py | 24 ++++++ tests/test_release_version.py | 2 +- 23 files changed, 315 insertions(+), 15 deletions(-) create mode 100644 tests/test_brand.py diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 827c1be..4bd90c8 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -65,6 +65,12 @@ whole screen, invokes Home Assistant-aware providers, renders Liquid fragments, and composes a single TRMNL document. The Renderer App contract remains `HTML + width + height -> PNG` and contains no project or HA concepts. +Theme, font family, and text scale are project-level display preferences. The +composer maps them to TRMNL Framework screen classes before sending the same +HTML to preview and Media Source. Widgets do not own or duplicate these +settings; they react to the framework variables and their physical region +container. + Backend panel registration follows the current Core Dynalite pattern: local static files, WebSocket commands, and an admin-only custom panel. Studio is not a standalone frontend, so its component model follows the Matter and ZHA diff --git a/CHANGELOG.md b/CHANGELOG.md index 95280cf..babb764 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ ## Unreleased +## 0.5.1 + +- Add project-level light and dark TRMNL themes. +- Add project-level default, classic, and TRMNL font families plus four text scales. +- Add a short-wide Weather composition for dense grids such as 800×480 at 3×3. +- Verify bundled Home Assistant brand icon dimensions in CI. + ## 0.5.0 - Introduce self-contained widget packages under `opendisplay_studio/widgets`. diff --git a/WIDGET_CONTRACT.md b/WIDGET_CONTRACT.md index ba9275c..2b3050c 100644 --- a/WIDGET_CONTRACT.md +++ b/WIDGET_CONTRACT.md @@ -125,6 +125,12 @@ The panel displays the PNG returned by the same renderer used for Media Source. Its local widget component is only a temporary loading fallback; it is not a second authoritative renderer. +Display-wide presentation is part of the project contract. `theme` maps to +the TRMNL light or dark screen mode, `fontFamily` selects the default, classic, +or TRMNL family, and `textScale` selects small, regular, large, or extra-large +framework typography. These settings must remain outside widget configuration +so every package shares one predictable display environment. + `--screen-w` and `--screen-h` describe the physical device. Responsive widget decisions use the actual CSS region container dimensions, never names such as full or half. A package must work for arbitrary device and region sizes. diff --git a/custom_components/opendisplay_studio/composer.py b/custom_components/opendisplay_studio/composer.py index 29ec07b..b70a541 100644 --- a/custom_components/opendisplay_studio/composer.py +++ b/custom_components/opendisplay_studio/composer.py @@ -32,10 +32,10 @@ class ProjectComposeError(Exception): STUDIO_STYLES = """