feat(example) add style examples
This commit is contained in:
24
examples/styles/lv_example_style_12.c
Normal file
24
examples/styles/lv_example_style_12.c
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "../lv_examples.h"
|
||||
#if LV_BUILD_EXAMPLES && LV_USE_IMG
|
||||
|
||||
/**
|
||||
* Local styles
|
||||
*/
|
||||
void lv_example_style_12(void)
|
||||
{
|
||||
static lv_style_t style;
|
||||
lv_style_init(&style);
|
||||
lv_style_set_bg_color(&style, lv_palette_main(LV_PALETTE_GREEN));
|
||||
lv_style_set_border_color(&style, lv_palette_lighten(LV_PALETTE_GREEN, 3));
|
||||
lv_style_set_border_width(&style, 3);
|
||||
|
||||
lv_obj_t * obj = lv_obj_create(lv_scr_act());
|
||||
lv_obj_add_style(obj, &style, 0);
|
||||
|
||||
/*Overwrite the background color locally*/
|
||||
lv_obj_set_style_bg_color(obj,lv_palette_main(LV_PALETTE_ORANGE), LV_PART_MAIN);
|
||||
|
||||
lv_obj_center(obj);
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user