- Home /
GUIStyle textColor not working
Hi.
I believe there must be a simple solution, however I couldn't get to it yet.
I want to display with different colors a label.
so I have:
GUIStyle style1 = new GUIStyle();
GUIStyle style2 = new GUIStyle();
...
style1.normal.textColor = new Color(255, 255, 255);
style2.normal.textColor = new Color(255, 144, 90);
...
GUILayout.Label("my text", condition ? style1 : style2);
and I always get the text color white.
Thanks in advance.
Comment
Best Answer
Answer by Eric5h5 · Oct 11, 2014 at 06:15 PM
Color values are in the range 0.0 - 1.0, not 0 - 255.
I see. Now, what would be the value of 144? $$anonymous$$ust be 144/255.0
Thanks. Accepting answer
Your answer
Follow this Question
Related Questions
Unity Preferences' Large Heading Font 2 Answers
Why can I not change my font style in javascript? 0 Answers
How to get a bold Labelfield (EditorGUIStyle) 2 Answers
Custom GUI style 2 Answers
Animator Window Layout Problem 0 Answers