Change the screen color, base on the default theme.
What MCU/Processor/Board and compiler are you using?
STM32F7
What LVGL version are you using?
7.70
What do you want to achieve?
Change the screen color from default white to other like black color.
What have you tried so far?
Have apply the my style to the basic screen object , but nothing help.
Code to reproduce
Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.
The code block(s) should be formatted like:
/*You code here*/
Screenshot and/or video
If possible, add screenshots and/or videos about the current state.
Hi,Sir,
Many Thanks!
It does work!
It was confused why my code below can not work.
lv_style_init(&style_bg_src);
lv_style_set_bg_color(&style_bg_src, LV_STATE_DEFAULT, LV_COLOR_BLACK);
lv_style_set_bg_grad_color(&style_bg_src, LV_STATE_DEFAULT, LV_COLOR_BLACK);
lv_style_set_radius(&style_bg_src, LV_STATE_DEFAULT, 5);
lv_obj_add_style(lv_disp_get_layer_top(NULL),LV_OBJ_PART_MAIN, &style_bg_src);
lv_obj_refresh_style(lv_disp_get_layer_top(NULL), LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL);
Further More, why it just left 1 default theme in the v7.7 or above and many other theme choice in the v6.0 ? To customize the theme is a big headache as few word in the doccument touch on it. Any detail about the customer theme ?
Third, does the v7.7 fast than v6.0? My application is heavy loaded by the caculation of main task and I was considering the upgrading, worth or not. I was already apply the DMA2D in my F7 mcu and running with a 1024*600 TFT. Any comment will be appreciated!
I’m still learning myself, but from what I do understand the object returned by lv_disp_get_layer_top() is transparent by default, so you’d never see your styles that you applied. My code used the screen object, which is below the top layer and is not transparent by default.