UnityEditor.ColorPicker.CreateGradientTexture C# (CSharp) Method

CreateGradientTexture() private static method

private static CreateGradientTexture ( string name, int width, int height, Color leftColor, Color rightColor ) : Texture2D
name string
width int
height int
leftColor Color
rightColor Color
return UnityEngine.Texture2D
        private static Texture2D CreateGradientTexture(string name, int width, int height, Color leftColor, Color rightColor)
        {
            Texture2D textured = new Texture2D(width, height, TextureFormat.ARGB32, false) {
                name = name,
                hideFlags = HideFlags.HideAndDontSave
            };
            Color[] colors = new Color[width * height];
            for (int i = 0; i < width; i++)
            {
                Color color = Color.Lerp(leftColor, rightColor, ((float) i) / ((float) (width - 1)));
                for (int j = 0; j < height; j++)
                {
                    colors[(j * width) + i] = color;
                }
            }
            textured.SetPixels(colors);
            textured.wrapMode = TextureWrapMode.Clamp;
            textured.Apply();
            return textured;
        }