# How to set an EditorGUI foreground color for the light Unity skin?

Writing an asset management GUI as part of our editor tools, I am in some places colouring LabelFields. Working mostly in the dark Pro skin, this seems to work just fine:

GUI.color = Color.green;
EditorGUILayout.LabelField("Name", GUILayout.Width(75f));
GUI.color = Color.white;


When switching to the light default skin however, this colouring is no longer visible. The usual GUI.backgroundColor still functions fine there as it does in the dark skin.

Is this "foreground" colour something specific to the dark Pro skin? If so, is there perhaps another way to achieve a similar effect?

No, foregroundColor is not specific to Pro skin: it's just that font color in light skin is black.

The way GUI.foregroundColor (and all other colors in GUI) works is that it's multiplied by whatever color is drawn. But black multiplied by anything stays black, so the setting appears to have no effect.

Fortunately, there are pre-defined editor styles that use white font color in any skin. Use this line:

GUI.color = Color.green;
EditorGUILayout.LabelField("Name", EditorStyles.whiteLabel, GUILayout.Width(75f));
GUI.color = Color.white;


By the way, in Light skin default GUI.color is not white, but some kind of gray, I don't know exact RGB values. So to restore default look, you should save this value and restore it later, not just set color to white.

• Oh geez...and here I was thinking "hmm, my colors look muddy in the Pro skin. They must be multiplying them...". Tested and it works. Thank you ever so much. (p.s. you'll get the bounty once I can award it ;) ) – Bart Mar 8 '13 at 11:05