Assets/FlexibleColorPicker/Scripts/FlexibleColorPicker.cs
/// <summary>
/// Get normalized value of the current color according to the given picker.
/// This value can be used to adjust the position of the marker on a slider.
/// </summary>
Get normalized value of the current color according to the given picker.
This value can be used to adjust the position of the marker on a slider.
Get normalized value of the current color according to the given picker . This value can be used to adjust the position of the marker on a slider .
private float GetValue1D(PickerType type) {
        switch(type) {
        case PickerType.R: return Mathf.InverseLerp(AS.r.min, AS.r.max, bufferedColor.r);
        case PickerType.G: return Mathf.InverseLerp(AS.g.min, AS.g.max, bufferedColor.g);
        case PickerType.B: return Mathf.InverseLerp(AS.b.min, AS.b.max, bufferedColor.b);
        case PickerType.H: return Mathf.InverseLerp(AS.h.min, AS.h.max, bufferedColor.h / HUE_LOOP);
        case PickerType.S: return Mathf.InverseLerp(AS.s.min, AS.s.max, bufferedColor.s);
        case PickerType.V: return Mathf.InverseLerp(AS.v.min, AS.v.max, bufferedColor.v);
        case PickerType.A: return Mathf.InverseLerp(AS.a.min, AS.a.max, bufferedColor.a);
        default:
            throw new Exception("Picker type " + type + " is not associated with a single color value.");
        }
    }
private float GetValue1D ( PickerType type ) { switch ( type ) { case PickerType . R : return Mathf . InverseLerp ( AS . r . min , AS . r . max , bufferedColor . r ) ; case PickerType . G : return Mathf . InverseLerp ( AS . g . min , AS . g . max , bufferedColor . g ) ; case PickerType . B : return Mathf . InverseLerp ( AS . b . min , AS . b . max , bufferedColor . b ) ; case PickerType . H : return Mathf . InverseLerp ( AS . h . min , AS . h . max , bufferedColor . h / HUE_LOOP ) ; case PickerType . S : return Mathf . InverseLerp ( AS . s . min , AS . s . max , bufferedColor . s ) ; case PickerType . V : return Mathf . InverseLerp ( AS . v . min , AS . v . max , bufferedColor . v ) ; case PickerType . A : return Mathf . InverseLerp ( AS . a . min , AS . a . max , bufferedColor . a ) ; default : throw new Exception ( " " + type + " " ) ; } }
Get normalized value of the current color according to the given picker.
Get normalized value of the current color according to the given picker .
type
PickerType