Substring colors and formatings?

In the TextLabel object, I want to color or format certain parts of the text as in this example:

Do you have any ideas how to split the text into parts, while marking which elements need to be painted or formatted?
For example, “This < bold >is an < red >example” split into parts “This”, “is”, “an”, “example”, and somehow mark the parts that need to be changed.

I tried to break the text with a string.match, but could only achieve “This” “< bold >”, “is”, “an”, “< red >”, “example”.

Now I have an idea to write words in separate arrays (for example in “bold” array or “red” array), and then read these arrays and change these words when adding Textlabels, but my idea needs to be improved.

By the way, excuse me for my English

1 Like

If you’re trying to acomplish something like this, I’d say your best bet is Defaultio’s Rich Text Markup module. You can find documentation inside of the module.

You could always create your own Rich Text module, but it’s easier said than done and would most likely take way longer than simply using this module.

5 Likes

Thank you! This is what i looking for!