Languages

Menu
Sites
Language
Change the color of label text

I'm trying to change the color of the label using the following code

evas_object_color_set(vc->mylabel, 255, 0, 0, 255);

 

This doesn't reflect any color on the label. I'm using the UI builder to build the UI and performing the change of the color of the label inside the button click.

View Selected Answer

Responses

6 Replies
Mark as answer
Alex Dem

Hi,
If you need to change text color only just try to apply for your label:

elm_object_text_set(label, _("<color=#FF4500FF>Your text</color>"));

Alexey.

Vivek Chandra Amancha

Thanks Alex, it worked.

Jean Yang

Hi,

You can check the below document  in help documents, it's inlcude all font seting.

Tizen Mobile Native App Programming > Programming Guide > UI: Creating the Application UI > Evas Rendering

colin Rao

not only can't change front color for lable, but also for anyother widget, such as entry. we can change the text color via <color...></color> tag, but while call elm_object_text_get, the color tag will be included, in my opinion this isn't a good manner(possible it's a bug). 

I think, the efl framework should open such api, such as evas_object_color_set, for widget.

Alex Dem

Hi,
I did not face such api, only for TizenID .
Alexey.

Alex Dem

Prev comment was wrong, but I just wanted to add one note:
you could look at Native Example->Example->UI Controls (elementary) sample.  In common case you should use EDC (Edje Data Collection) to configure label container.
And in this case you should place your label onto layout widget (as in example) and edit label's properties in *.edc file
Proposed above way is applicable to set text  properties ( font/color/align) but I don't know way how to configure another params of label programmatically (background color for example). Per my opinion it is possible with EDC only, but maybe someone could provide native api for this.
Alexey.