- Home /
Color.white not so much white...
I'm experiencing an annoying problem, or maybe a bug, in my iOS game.
I have a GUI.Label
text with a custom font, wich I specified to be white using GUI.color = Color.white
just the line before (so it's 100% opaque). Everything it's fine until I noticed it doesn't appear white, but light gray. This hapens both on the Unity Editor on Mac, and on the iOS App.
The strange thing is that, inside the Font asset, both the Font Material and Font Texture are perfectly crystal white, and so when I write with the same font in Photoshop. I think we can exclude a problem in the font itself.
This is nothing really problematic for the game, but it's affecting a bit the visual style. Did anyone of you have experienced something similar, or have solutions about this?
Thanks!
EDIT: Here it is the piece of code for the text.
GUI.skin.font = LapFont;
GUI.skin.label.alignment = TextAnchor.UpperLeft;
GUI.color = Color.black;
GUI.Label(LapTextRect4,"Lap "+(MC.myLaps+1)+" of 3");
GUI.Label(LapTextRect2,"Lap "+(MC.myLaps+1)+" of 3");
GUI.color = Color.white;
GUI.Label(LapTextRect,"Lap "+(MC.myLaps+1)+" of 3");
This same code generates a perfectly white text in another game I have, with another font. Anyways here you are a comparative screenshot from the current game I'm working on, with the original font both inside and outside Unity.
Sorry but currently I'm not on my $$anonymous$$ac and can't upload that. I'll do it as soon as I'll be at my computer.
A screenshot of the font itself would be nice too, being out of your unity game.
Definitely looks like a grey GUISkin color as explained below.
i.e. set:
GUI.skin.label.normal.textColor = Color.white;
(though normally you'd do that by editing the skin in the inspector, not code).
Answer by Waz · Jun 26, 2011 at 01:13 PM
Is the text color for Label in your GUISkin set to White?
There are 3 values multiplied together that determine GUI label colour:
The font texture pixels
The current GUI.color
The text color of the Label style in the current GUISkin
As I wrote in the question:
"I have a GUI.Label text with a custom font, wich I specified to be white using GUI.color = Color.white just the line before"
This solution works perfectly on another game I have, but it's not in this case.
Oh, now I understand...
Since I were not using a GUISkin asset, I guess I have been using the default one wich should be white. But I just noticed that when you create a default GUISkin, the color for Normal Labels is RGB(230,230,230).
So I added "GUI.skin.label.normal.textColor = Color.white;" at the beginning of my code and now everything is perfect.
Thank you so much. :)
Answer by BerggreenDK · Jun 25, 2011 at 01:48 PM
Could it be some sort of color-management or bad lightning/low ambient?
EDIT
I believe its the pre-defined color tables because it seems that Color.White should be 0xE5E5E5 - but the PC might overrule this nonsens and thereby making it Mac OS/iOS related only in your situation.
http://www.google.dk/search?q=mac+color+white+is+e5e5e5
So use the RGB value of RGB(255,255,255)
No, they're not. Color managment is correct (I have some bright white icons in the game), and ambient light doesn't affect GUI.
How about if you use RGB for the color ins$$anonymous$$d of Color.white? I am thinking if the Alpha could be active somehow?
what font-size? could it be anti-aliasing on the font?
I tried to use Color(1,1,1,1) too and different Font Antialiasing settings, but without results.
I use the same font whit different sizes, from 40 to 120, but it's still grayish.
Answer by dretwy · Nov 25, 2014 at 11:54 PM
It should help GUI.skin.label.normal.textColor = Color.white;
Your answer
Follow this Question
Related Questions
Changing the size of a GUI label 1 Answer
How do I change the font and color of GUI text? 1 Answer
Changing a GUILabel text SIZE 3 Answers
GUI.label overlapping text 1 Answer
Alpha not working in GUITex 0 Answers