Godot - How to create rainbow text in RichTextLabel
This is an example of how to create rainbow text in a RichTextLabel node using GDScript.
This method is not available for Label nodes.
Enables the `bbcode_enabled` property.
Wraps the text to rainbow in the `[rainbow]` tag.
The `[rainbow]` tag can specify parameters as follows: `freq` for speed, `sat` for saturation, and `val` for value (?).
The documentation states that setting `freq` to `0` will stop the animation and the rainbow will be static, but this has not been confirmed in version 4.2.
var label = RichTextLabel.new()
add_child(label)
label.global_position = Vector2(0, 0)
label.size = Vector2(200,200)
# Create rainbow text in RichTextLabel
label.bbcode_enabled = true
label.text = "[rainbow freq=1.0 sat=0.8 val=0.8]Rainbow Text[/rainbow]"