public void ChangeColor(Color colorToEdit) { currentColor = colorToEdit; savedColor = colorToEdit; prevColor = colorToEdit; aValue = currentColor.a * 255f; rValue = currentColor.r * 255f; gValue = currentColor.g * 255f; bValue = currentColor.b * 255f; aText = aValue.ToString("F0"); rText = rValue.ToString("F0"); gText = gValue.ToString("F0"); bText = bValue.ToString("F0"); currentHSVColor = new HSBColor(currentColor); prevHSVColor = new HSBColor(currentColor); GenerateTextures(); rainbow = MaterialUtils.GenerateRainbowGradient(120, 20); aTexture = MaterialUtils.GenerateGradientTexture(100, 20, Color.black, Color.white); colorField = MaterialUtils.GenerateColorField(colorFieldSize, colorFieldSize, currentHSVColor.ToColor()); WindowPosition = new Rect(Screen.width / 2 - 100, Screen.height / 2f, 210, 100); showWindow = true; }
public void GenerateTextures() { rTexture = MaterialUtils.GenerateGradientTexture(100, 20, new Color(0.0f, currentColor.g, currentColor.b, 1.0f), new Color(1.0f, currentColor.g, currentColor.b, 1.0f)); gTexture = MaterialUtils.GenerateGradientTexture(100, 20, new Color(currentColor.r, 0f, currentColor.b, 1.0f), new Color(currentColor.r, 1f, currentColor.b, 1.0f)); bTexture = MaterialUtils.GenerateGradientTexture(100, 20, new Color(currentColor.r, currentColor.g, 0f, 1.0f), new Color(currentColor.r, currentColor.g, 1f, 1.0f)); swatch = MaterialUtils.GenerateColorTexture(60, 20, currentColor); }