Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
Posts: 19
Registered: ‎07-12-2012
My Device: 9700, Playbook 16GB, and Dev Alpha
Accepted Solution

Change color just for specific word in a Label?

Hi is it possible to change the color for just one word in a Label?

 

For example the text is "How are you **John**?" The word between double asterisks (**) will have different color. So it is printed as "How are you John?"

 

I can use string.replace() to delete the asterisks, but can't find a way to change the color.

 

Any solution? Thanks

Developer
Posts: 22
Registered: ‎12-11-2012
My Device: Blackberry Z10

Re: Change color just for specific word in a Label?

try to use

Label {    
    text: "<html>How are you <span style=\"color:red;\">John</span></html>"
}

 

Contributor
Posts: 19
Registered: ‎07-12-2012
My Device: 9700, Playbook 16GB, and Dev Alpha

Re: Change color just for specific word in a Label?

Thanks, it works! :Yes:

Never knew that we can add HTML and CSS for Cascades