1 #include "../../lv_examples.h"
2 #if LV_USE_BARCODE && LV_BUILD_EXAMPLES
3 
4 /**
5  * Create a Barcode
6  */
lv_example_barcode_1(void)7 void lv_example_barcode_1(void)
8 {
9     lv_color_t bg_color = lv_palette_lighten(LV_PALETTE_LIGHT_BLUE, 5);
10     lv_color_t fg_color = lv_palette_darken(LV_PALETTE_BLUE, 4);
11 
12     lv_obj_t * barcode = lv_barcode_create(lv_screen_active());
13     lv_obj_set_height(barcode, 50);
14     lv_obj_center(barcode);
15 
16     /*Set color*/
17     lv_barcode_set_dark_color(barcode, fg_color);
18     lv_barcode_set_light_color(barcode, bg_color);
19 
20     /*Add a border with bg_color*/
21     lv_obj_set_style_border_color(barcode, bg_color, 0);
22 
23     /*Set data*/
24     lv_barcode_update(barcode, "https://lvgl.io");
25 }
26 
27 #endif
28