AplosColorPickerView
AplosColorPickerView is a MonoBehaviour (namespace AplosConsole.Views.ColorPicker) that ties
the saturation/value field, hue rail, alpha rail, hex + RGBA inputs, and preview swatches into one
HSV-based color picker. HSVA is the single source of truth and everything else is derived from it
on each refresh.
Inheritance
object
↳ Object
↳ Component
↳ Behaviour
↳ MonoBehaviour
↳ AplosColorPickerView
Inherited Members:
MonoBehaviour.IsInvoking()MonoBehaviour.CancelInvoke()MonoBehaviour.StartCoroutine(IEnumerator)MonoBehaviour.StopCoroutine(Coroutine)MonoBehaviour.StopAllCoroutines()Behaviour.enabledComponent.gameObjectComponent.transformObject.name- …
Namespace: AplosConsole.Views.ColorPicker
Implements: IWindowIconProvider, IColorPicker
Properties
| Name | Data Type | Description |
|---|---|---|
CurrentColor |
Color |
The currently selected color, computed from the internal HSVA state. Read-only. |
WindowIcon |
Sprite |
The icon shown in the host window's title bar. Read-only. |
Events
| Name | Data Type | Description |
|---|---|---|
onColorChanged |
ColorChangedEvent |
Raised whenever the HSVA state changes and the UI is refreshed, passing the resulting color. |
onApplied |
ColorChangedEvent |
Raised when the apply button is clicked (or the Show callback fires), passing the committed color. |
onCancelled |
UnityEvent |
Raised when the cancel button is clicked (or the Show callback fires). |
Public methods
Show
Parameters:
initial(Color) — Initial color to open the picker with.onApply(UnityAction<Color>) — Callback invoked once the color is applied.onCancel(UnityAction) — Callback invoked if the picker is cancelled. Defaults tonull.
Example
colorPickerView.Show(Color.white, color => { /* apply the chosen color */ });
Description: Opens the picker with the given initial color, temporarily wiring the supplied callbacks to onApplied/onCancelled for this session only. Implements IColorPicker.Show.
Provide
Example
Sprite icon = colorPickerView.Provide();
Description: Returns the WindowIcon sprite. Implements IWindowIconProvider.
Commit
Example
colorPickerView.Commit();
Description: Accepts the current color as the new baseline, updating the "old" preview swatch.
Cancel
Example
colorPickerView.Cancel();
Description: Reverts the picker back to the initial color.