Themes - problem with automatic template loading


I want to use file: lv_thene.c and lv_theme.h in my project. I copy files from the catalog: lvgl/src/lv_theme to the main catalog. I changed the name of the files to themes.c and themes.h

What MCU/Processor/Board and compiler are you using?

STM32F769NI / STM32F769I-DISCO / Atollic TrueStudio/VisualStudio 2019/LittlevGL 6.0

What do you want to achieve?

I want to use the files without changing anything in the library files

What have you tried so far?

I wrote in themes.h in the section for TA (LV_USE_TA) two lines:

lv_style_t * czerw; 
lv_style_t * ziel;    /* green TA - picture B */

Styles of all objects, I declared in another file - theme_default_moje.c (and .h)
I changed the paths to the themes.h file in the lvgl.h, themes.c and the main file of the program. When Picture A shows the result of the simulation.
If I assign the style directly like this

lv_tabview_set_style (object, LV_TABVIEW_STYLE_BTN_BG, th->;
lv_obj_set_style(t1_tmp, th->style.ta.ziel);

the style loads perfectly during the simulation.
If I change the path to lv_theme.h (in lvgl to src/lv_themes/lv_theme.h) that is to the file from the library then the template will load properly (picture B).
I have checked experimentally and only the path to the .h file affects whether the style loads correctly. If this is the lv_theme.h file contained in the library, then the style loads correctly. If the themes.h file is in the root directory, the style does not load. Where the lv_theme.c (theme.c) file is located does not matter.
For automatic style loading I used the code from lv_test_theme_2.c

Code to reproduce

if (th_options[0] == '\n')

th_act = themes[0];
if (th_act == NULL) {
	LV_LOG_WARN("no theme");
th = lv_theme_get_current();

Screenshot and/or video



I am still learning LittlevGL and maybe I don’t understand something. I am asking for help and explaining the problem.


I’m not clearly understand how you want to use the theme.
Basically all you need to do is create a new theme (recommended to use lv_theme_templ.c/h) and initialize and load it. So you don’t have to modify anything inside lvgl.

This sounds like an issue with your code setup, not LittlevGL. The path of C files on a disk should not affect LittlevGL’s run-time behavior. You might have two header files/source files with the same name. Possibly the wrong one is being used.