Material Box

Material Box

WEB Design & Material Images

Godot - How to change text color partially in RichTextLabel

Godot

This is an example of how to change text color partially in a RichTextLabel node using GDScript.
This method is not available for Label nodes.


Enables the `bbcode_enabled` property.
Wraps the text to change color in the `[color]` tag.
The `[color]` tag can specify a color name or color code as a parameter.

var label = RichTextLabel.new()
add_child(label)
label.global_position = Vector2(0, 0)
label.size = Vector2(200,200)

# Change the color of RichTextLabel's text partially
label.bbcode_enabled = true
label.text = "Change [color=#FFF000]Color[/color] Text"

Godot

TitleGodot - How to change text color partially in RichTextLabel

CategoryGodot

Created

Update

AuthorYousuke.U