0 votes

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 addcoloroverride("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.

asked Jun 20 in Engine by AnJo888 (15 points)
edited Jun 21 by AnJo888

1 Answer

+1 vote
Best answer

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:
[cell][color=yellow]500 food[/color][/cell]
[cell][color=yellow]5000 gold[/color][/cell]
[cell]At least 10 followers[/cell]
[cell]20 ore[/cell]
answered Jun 21 by JimArtificer (699 points)
selected Jun 21 by AnJo888

Works like a charm.
Thank you.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.