Jake quin
Jake quin

Reputation: 742

How to add color on specific words on QML Text

Hello i would like to add different color on specific words of a string to be used in QML Text

Text {

    text: "Blue Red Yellow Green"

}

I know that you can add color to the whole text, but i would like to add specific color on specific words. is this possible? and how is it achieved?

Upvotes: 5

Views: 3589

Answers (1)

Nejat
Nejat

Reputation: 32685

Text items can display both plain and rich text. For example you can have:

Text {
    text: "<font color=\"#0000FF\">Blue</font> <font color=\"#FF0000\">Red</font>"
}

Upvotes: 12

Related Questions