How to change the label color of an IntField

How can I change the label color of an IntField in Unity? I have tried the following:

TextFieldStyles = new
GUIStyle(EditorStyles.numberField);
GUI.contentColor = Color.white;
GUI.color = Color.white;
TextFieldStyles.normal.textColor = Color.white;
EditorGUILayout.IntField(label,value,TextFieldStyles);

The only field that changes is the ‘value’ field. The ‘label’ field however, stays black. How can I change it to, for example, white?

This doesn’t work either: PropertyField Label Color - Questions & Answers - Unity Discussions

Found the answer:
EditorStyles.label.normal.textColor = Color.white;

4 Likes

Thanks!!!

To change only field label.

FieldTextColor

public class PrefabHolder : PropertyAttribute {

}

[CustomPropertyDrawer(typeof(PrefabHolder))]
public class PrefabHolderDrawer : PropertyDrawer {
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) {
        //PrefabHolder colorize = (PrefabHolder)attribute;

        Color labelNormalTextColorDefault = EditorStyles.label.normal.textColor;

        EditorStyles.label.normal.textColor = Color.yellow;

        EditorGUI.PropertyField(position, property, label);

        EditorStyles.label.normal.textColor = labelNormalTextColorDefault;
    }
}