How to set background of messagebox

Description

I am struggling to understand how to change the background color of a messagebox.
There are plenty of examples but these seem to rely on lv_obj_set_style_local_bg_color which I don’t believe exists anymore?

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

Raspberry Pi 4

What LVGL version are you using?

Latest

What do you want to achieve?

Change the background color of the messagebox so that it stands out.

What have you tried so far?

Nothing.

Code to reproduce

Screenshot and/or video

Hi @AndyFraser,

Please see test code here to demonstrate:

void test() {

	static lv_obj_t 		*mb_test;
	static const char		*btns[] ={"Yes", "No", ""}; /*Button description.*/

	mb_test = lv_msgbox_create(NULL, "Test\n", "Test", btns, true);
	lv_obj_set_style_bg_color(mb_test, lv_palette_main(LV_PALETTE_BLUE_GREY), LV_PART_MAIN);
}

I hope that helps :slight_smile:

Kind Regards,

Pete

1 Like

Pete,

Thanks for that - works perfectly :slight_smile:

Best Regards

Andy

1 Like