I am creating some GUI elements for my inventory, for one of those elements I need colored text and I found out unity has support for that, and according to the documentation a color tag should accept hex colors
for example:
"<color=#AB2B2B> text </color>"
So I tested this out and after trying it out a few times I noticed unity will only use the ‘default colors’ listed here: Redirecting to latest version of com.unity.ugui
So my question is if there’s some way to easily include (multiple) hex colors in a string.
Am I doing something wrong or is this just a bug?
(Using: Unity Free, Windows x64)
Eric5h5
September 7, 2014, 7:51pm
2
The default colors are just the built-in shortcuts; you can use any colors and your example is fine.
–Eric
That’s what I thought, but just for example:
print("<color=#5DC96D> Test Text </color>");
#5DC96D according to ColorPicker.com :
http://puu.sh/bpL0H/ca9af960e7.jpg
#5DC96D according to Unity:
http://puu.sh/bpKMT/54fc33351e.png
I whish I could believe you but this doesn’t look like it works…
Eric5h5:
Works here:
–Eric
Hmm, that’s weired… Maybe it’s a Unity Pro - only feature? I have no clue why it doesn’t work otherwhise…
Thanks for the help anyways
Eric5h5
September 7, 2014, 8:23pm
6
It’s not a Pro-only feature. Somehow I don’t think “randomly changing colors to other colors” would work as a Unity Free feature…
–Eric
Okay, got the problem resolved now!
I found this page in the unity answers:
According to this you can’t have the text color of your gui set to black and you should also use lowercase for the color codes.
I bet the rich text is multiplicative with the primary text color. That would allow things like fading out the alpha of a rich text element.