Topic was automatically imported from the old Question2Answer platform.
Asked By
DimitriyPS
Old Version
Published before Godot 3 was released.
I have in the global script there is a variable of type Color. I need to use this color in the tag RichTextLabel [color]. How do I convert to the format of the tag [color]?
I’m telling you, the color that I want to use is stored in a variable of type: “Color”:
var c_MyColor=Color(r,g,b,a)
The tag RichTextLabel [color] doesn’t accept this variable… or am I doing it wrong?
DimitriyPS | 2016-07-28 14:24
You would have to use parse_bbcode I believe and use +str(colorvariable) dynamically when updating the text I believe
wombatTurkey | 2016-07-28 14:44
No it is not working:
var c_MyColor=Color(r,g,b,a)
RichTextLabel.set_ddcode("[color="+str(c_MyColor)+"] Bla bla bla... [/color]")
is not working… Please tell me how to really possible do it?
DimitriyPS | 2016-08-22 15:12
Just replace Color(r,g,b,a) with “#hexcodevalue”
wombatTurkey | 2016-08-22 18:45
My game is very advanced interface. That’s a lot of complex scenes. Colors which are stored in variables (in global scripts) are used for different purposes. If I decide to change some color, I prefer to change one variable. So I don’t want to use the “#hexcodevalue” locally.
Prompt how to convert a Color variable in the “#hexcodevalue”?