Exemplo n.º 1
0
        public IMColorPicker(Color c, IMColorPreset pr)
        {
            Setup();

            _colorPrev = c;
            color      = c;
            UpdateSVTexture();

            preset = pr;
        }
Exemplo n.º 2
0
        static IMColorPicker()
        {
            circle            = Resources.Load <Texture2D>("imCircle");
            rightArrow        = Resources.Load <Texture2D>("imRight");
            leftArrow         = Resources.Load <Texture2D>("imLeft");
            button            = Resources.Load <Texture2D>("imBorder");
            buttonHighlighted = Resources.Load <Texture2D>("imBorderHighlighted");

            previewStyle = new GUIStyle();
            var previewSize  = new Vector2Int(kPreviewBarWidth, kPreviewBarHeight);
            var checkerBoard = CreateChekcerBoardTexture(previewSize, 4, Color.white, Color.HSVToRGB(0f, 0f, 0.8f));

            previewStyle.normal.background = checkerBoard;

            labelStyle          = new GUIStyle("Label");
            labelStyle.fontSize = 12;

            hueStyle = new GUIStyle();
            var hueTexture = CreateHueTexture(20, kHSVPickerSize);

            hueStyle.normal.background = hueTexture;

            presetStyle = new GUIStyle();
            presetStyle.normal.background = button;

            presetHighlightedStyle = new GUIStyle();
            presetHighlightedStyle.normal.background = buttonHighlighted;

            var whiteTex = new Texture2D(previewSize.x, previewSize.y);

            whiteTex.SetPixels(whiteTex.GetPixels().Select(_ => Color.white).ToArray());
            whiteTex.Apply();
            previewContents = new GUIContent(whiteTex);

            defaultPreset = ScriptableObject.CreateInstance <IMColorPreset>();
        }
Exemplo n.º 3
0
 public IMColorPicker(IMColorPreset pr) : this(Color.red, pr)
 {
 }