public void Notify_HSVUpdated() { tempColor = ColorHelper.HSVtoRGB(H, S, V); tempColor.a = A; _tempPreviewBG = CreatePreviewBG(tempColor); if (_preview) { _hexOut = _hexIn = ColorHelper.RGBtoHex(tempColor); } if (_autoApply) { Apply(); } }
public void Notify_RGBUpdated() { // Set HSV from RGB ColorHelper.RGBtoHSV(tempColor, out _H, out _S, out _V); _A = tempColor.a; // rebuild textures CreateColorPickerBG(); CreateHuePickerBG(); if (_preview) { CreateAlphaPickerBG(); } // set slider positions _huePosition = (1f - _H) / UnitsPerPixel; _pickerPosition.x = _S / UnitsPerPixel; _pickerPosition.y = (1f - _V) / UnitsPerPixel; if (_preview) { _alphaPosition = (1f - _A) / UnitsPerPixel; } // set the color block and update hex fields _tempPreviewBG = CreatePreviewBG(tempColor); if (_preview) { _hexOut = _hexIn = ColorHelper.RGBtoHex(tempColor); } // call callback for auto-apply if (_autoApply) { Apply(); } }