private GUIStyle CreateBackgroundStyle( byte gray0, byte gray1)
{
const int height = 64;
float gray = gray0;
float step = ((float)gray1 - (float)gray0) / (float)height;
GUIStyle style = new GUIStyle();
Texture2D texture = new Texture2D( 1, height, TextureFormat.RGB24, false, true);
for( int i=0; i<height; i++) {
byte g = (byte)gray;
texture.SetPixel( 0, i, new Color32( g, g, g, 255));
gray += step;
}
texture.Apply();
style.normal.background = texture;
return style;
}
}