How to have correct color on imGUI Buttons (as dynamic textures) avoiding multiply effect ?

Hi, I am creating my own “button look” without using texture files,
and I’m struggling with their display (Unity Editor Custom Window) with incorrect color values.
They seems to be multiplied by some factor (maybe darken unity Editor skin color ?), and I can’t find a way to retrieve my exact colors.

92736-guimultiplyeffect.png

Here are a snippet of what I am doing, simplified of course.
I am using a picker to pick a color, and then the button that should be drawn with it has another color.
Thanks for any help on this !
On a GUIMultiplyEffect_EditorWindow.cs file :

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

public class GUIMultiplyEffect_EditorWindow :EditorWindow
	{
	Color buttonColor = Color.gray;

	[MenuItem("Window/GUIMultiply : EditorWindow", false, 42)]
	public static void ShowWindow()
		{
	EditorWindow.GetWindow(typeof(GUIMultiplyEffect_EditorWindow));
		}


	void OnGUI()
		{
		buttonColor = EditorGUILayout.ColorField(buttonColor);

		GUIStyle customButtonStyle = new GUIStyle(GUI.skin.button);

		Texture2D customBackgroundTexture = new Texture2D(2, 2);
		customBackgroundTexture.SetPixels(new Color[4] { buttonColor, buttonColor, buttonColor, buttonColor });
		customBackgroundTexture.Apply();

		customButtonStyle.normal.background = customBackgroundTexture;

		if (GUILayout.Button("My Button", customButtonStyle))
			{
			}
		}
	}

Make sure your color is completely opaque (alpha of 1.0) and you don’t set GUI.color to anything else than “white”. To be on the safe side you may want to manually set GUi.color to “Color.white”.

Of course when in run-mode inside the editor, all the Editor GUI get additionally “tinted” with the play-mode-tint color which you set in the editor preferences.

edit
I just went ahead and used your code 1:1. This is my result:

92757-guicolor.png

As you can see the displayed color is 100% the color i selected in the color field. I actually made a screenshot, cropped the editorwindow and checked the colors inside ms paint with the pipette tool. Both red areas are 100% red. Though the color picker has a frame around which blends slightly at the border. However the button itself is completely red as expected.

If you expected something different you should have said that in your question. You create a 2x2 texture that has a solid color and that’s what is displayed.