From b3cff566eb1ba79eb86a2b31df30e18691c9f241 Mon Sep 17 00:00:00 2001 From: guillempages Date: Sun, 6 Oct 2024 00:44:18 +0200 Subject: [PATCH] [lvgl] Remap image to img in "set_style_*" (#7546) --- esphome/components/lvgl/styles.py | 5 +++-- tests/components/lvgl/lvgl-package.yaml | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/esphome/components/lvgl/styles.py b/esphome/components/lvgl/styles.py index 26c2694a52..030db5fd22 100644 --- a/esphome/components/lvgl/styles.py +++ b/esphome/components/lvgl/styles.py @@ -12,7 +12,7 @@ from .defines import ( ) from .helpers import add_lv_use from .lvcode import LambdaContext, LocalVariable, lv, lv_assign, lv_variable -from .schemas import ALL_STYLES +from .schemas import ALL_STYLES, STYLE_REMAP from .types import lv_lambda_t, lv_obj_t, lv_obj_t_ptr from .widgets import Widget, add_widgets, set_obj_properties, theme_widget_map from .widgets.obj import obj_spec @@ -31,7 +31,8 @@ async def styles_to_code(config): value = await validator.process(value) if isinstance(value, list): value = "|".join(value) - lv.call(f"style_set_{prop}", svar, literal(value)) + remapped_prop = STYLE_REMAP.get(prop, prop) + lv.call(f"style_set_{remapped_prop}", svar, literal(value)) async def theme_to_code(config): diff --git a/tests/components/lvgl/lvgl-package.yaml b/tests/components/lvgl/lvgl-package.yaml index a3ed3047be..2b72f31770 100644 --- a/tests/components/lvgl/lvgl-package.yaml +++ b/tests/components/lvgl/lvgl-package.yaml @@ -67,6 +67,9 @@ lvgl: border_width: 2 pad_all: 4 align: center + - id: image_recolor + image_recolor: 0x10ca1e + image_recolor_opa: cover touchscreens: - touchscreen_id: tft_touch