How to color a single row in a Rich Text Label table?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By AnJo888

Hello, there.

In my project, I was using a monospaced font, in a UI RichTextLabel.
I was using “[color=yellow]Blablabla[/color]” to indicate special lines and the world was almost perfect…
Not so much the font…
So I went after a better looking ‘NON-MONOSPACED’ font and the Hell broke loose.
The text was not beautifully aligned, anymore.
I continued reading and decided to use a table, in order to get my text aligned again.
You got it… no more color to show special info.
So far, I learned that the add_color_override(“default_color”, Color(1,1,0,1)) changes the color for all the table’s text (all the label’s, probably), even if I carefully change it before adding a specific table row (and change it back to the others).

Is there a way to get just one row, in my table, with a different font color?
(I tried including the “[color=yellow]” string, in front the real data string, but it only appeared as text… has no effect as modifier).

Thanks in advance.

:bust_in_silhouette: Reply From: JimArtificer

Ensure that your RichTextLabel has BbCode enabled and that you are setting the BbCodeText property, not the Text property.

Then use the [color=yellow]Hello world[/color] inside each cell you want to appear yellow instead of trying to use one color tag for an entire row.

For example:

Upgrade costs:
[table=2]
[cell][color=yellow]500 food[/color][/cell]
[cell][color=yellow]5000 gold[/color][/cell]
[cell]At least 10 followers[/cell]
[cell]20 ore[/cell]
[/table]

Works like a charm.
Thank you.

AnJo888 | 2020-06-21 02:57