Why in unity editor window script when making new Color instance it's not changing to the color ?

void DrawItemBackgroundColor(Rect bgRect)
       {
           if (Event.current.type == EventType.Repaint)
           {
               Color oldColor = GUI.color;
               GUI.color = new Color(255, 182, 193);

               var rect = bgRect;
               rect.height = Styles.headerBackground.fixedHeight;
               Styles.headerBackground.Draw(rect, false, false, false, false);

               rect.y += rect.height;
               rect.height = bgRect.height - rect.height;
               Styles.background.Draw(rect, false, false, false, false);

               GUI.color = oldColor;
           }
       }

This should change the color to pink :

GUI.color = new Color(255, 182, 193);

But it does nothing.

But if I’m doing :

GUI.color = Color.red;

It will change it to red the problem is that Color don’t have all the colors only some.

new Color32() takes initializers from 0 to 255 (bytes).

new Color() takes initializers from 0.0f to 1.0f (float)

1 Like

Great working.

Changing the line to this with Color32 make it color in nice light pink.

GUI.color = new Color32(255, 182, 193,100);

Thanks.