docs(label): add documentation and example for text recolor (#7460)

Signed-off-by: lhdjply <lhdjply@126.com>
Co-authored-by: Liam <30486941+liamHowatt@users.noreply.github.com>
Co-authored-by: Victor Wheeler <vwheeler63@users.noreply.github.com>
This commit is contained in:
Liu Yi
2024-12-23 03:26:10 +08:00
committed by GitHub
parent 36a6d173fc
commit cdaaeb81dc
2 changed files with 15 additions and 1 deletions

View File

@@ -8,7 +8,9 @@ void lv_example_label_1(void)
{
lv_obj_t * label1 = lv_label_create(lv_screen_active());
lv_label_set_long_mode(label1, LV_LABEL_LONG_MODE_WRAP); /*Break the long lines*/
lv_label_set_text(label1, "Recolor is not supported for v9 now.");
lv_label_set_recolor(label1, true); /*Enable re-coloring by commands in the text*/
lv_label_set_text(label1, "#0000ff Re-color# #ff00ff words# #ff0000 of a# label, align the lines to the center "
"and wrap long text automatically.");
lv_obj_set_width(label1, 150); /*Set smaller width to make the lines wrap*/
lv_obj_set_style_text_align(label1, LV_TEXT_ALIGN_CENTER, 0);
lv_obj_align(label1, LV_ALIGN_CENTER, 0, -40);