ColorPickerButton
Color button with a lazily created built-in picker and separate editing signals.
Set Color and connect ColorChanged to apply user edits to your model. Programmatic Color assignment updates the button and an existing picker, but emits no ColorChanged. If one action must work from both UI and code, put the model update in a shared method and call it explicitly.
GetPicker and GetPopup create internal objects on first access without opening the window. PickerCreated fires once after applying the current Color, EditAlpha and EditIntensity. Subscribe before the first getter if you want to configure the picker at creation time. Calling GetPicker from that handler is safe.
The returned ColorPicker and PopupPanel belong to the button: the popup is its internal child, and the picker is the popup’s child. Do not free or reparent them separately; freeing the button frees both. Create your own ColorPicker for a separate window with an independent lifetime.
Change the value through the button. Assigning GetPicker().Color directly does not update the button’s Color or emit its ColorChanged. Reassigning the same button Color also does not resynchronize a manually changed picker: the setter skips equal values. Configure picker appearance through GetPicker, and change the value through the button’s Color.
EditAlpha and EditIntensity control the corresponding editing UI rather than clearing data. Disabling alpha does not make the color opaque; disabling intensity does not clamp stored RGB to 0…1. An HDR value does not enable scene glow or tonemapping: these are separate rendering settings.
PopupClosed reports closure without an OK/cancel result. Do not treat it as confirmation that a color was applied. For cancellable editing, retain the original value in your model and define explicit apply/rollback rules. ColorChanged can also arrive when cancellation restores a value; it reports the value rather than only a new selection.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
ColorPickerButtonConstructor
public ColorPickerButton();Creates a black button (alpha = 1), with EditAlpha/EditIntensity = true and ToggleMode enabled. Built-in popup and picker are not created yet.
Properties3
ColorProperty
public Color Color { get; set; }Current color, including alpha and RGB values above 1. Assignment synchronizes an existing picker without ColorChanged. Equal values are skipped.
EditAlphaProperty
public bool EditAlpha { get; set; }Show alpha editing, default true. false retains the current alpha rather than forcing opacity. Propagates to existing and future pickers.
EditIntensityProperty
public bool EditIntensity { get; set; }Show intensity editing, default true. false neither clamps stored HDR components nor disables scene effects. Propagates to the built-in picker.
Methods8
GetPickColorColor
public Color GetPickColor();Current color, including alpha and RGB values above 1. Assignment synchronizes an existing picker without ColorChanged. Equal values are skipped.
ColorCurrent color, including alpha and RGB values above 1. Assignment synchronizes an existing picker without ColorChanged. Equal values are skipped.
GetPickerColorPicker
public ColorPicker GetPicker();Returns the button-owned ColorPicker, creating it on first access. Does not open the window. Do not free or reparent the result; change the value through the button’s Color.
ColorPickerReturns the button-owned ColorPicker, creating it on first access. Does not open the window. Do not free or reparent the result; change the value through the button’s Color.
GetPopupPopupPanel
public PopupPanel GetPopup();Returns the button-owned PopupPanel; first access also creates the picker. Does not open the window. Do not free or reparent the result separately.
PopupPanelReturns the button-owned PopupPanel; first access also creates the picker. Does not open the window. Do not free or reparent the result separately.
IsEditingAlphabool
public bool IsEditingAlpha();Show alpha editing, default true. false retains the current alpha rather than forcing opacity. Propagates to existing and future pickers.
boolShow alpha editing, default true. false retains the current alpha rather than forcing opacity. Propagates to existing and future pickers.
IsEditingIntensitybool
public bool IsEditingIntensity();Show intensity editing, default true. false neither clamps stored HDR components nor disables scene effects. Propagates to the built-in picker.
boolShow intensity editing, default true. false neither clamps stored HDR components nor disables scene effects. Propagates to the built-in picker.
SetEditAlphavoid
public void SetEditAlpha(bool show);Show alpha editing, default true. false retains the current alpha rather than forcing opacity. Propagates to existing and future pickers.
| Name | Type | Default |
|---|---|---|
show | bool | — |
showShow the corresponding editing UI without changing stored color components.
SetEditIntensityvoid
public void SetEditIntensity(bool show);Show intensity editing, default true. false neither clamps stored HDR components nor disables scene effects. Propagates to the built-in picker.
| Name | Type | Default |
|---|---|---|
show | bool | — |
showShow the corresponding editing UI without changing stored color components.
SetPickColorvoid
public void SetPickColor(Color color);Current color, including alpha and RGB values above 1. Assignment synchronizes an existing picker without ColorChanged. Equal values are skipped.
| Name | Type | Default |
|---|---|---|
color | Color | — |
colorNew Color value with alpha; RGB may exceed 1.
Signals and events3
ColorChangedEvent
public event ColorPickerButton.ColorChangedEventHandler ColorChanged;Value change from the built-in picker, including restoration on cancellation. The button’s Color is updated before the handler runs. The programmatic Color setter does not itself emit this signal.
| Name | Type | Default |
|---|---|---|
color | Color | — |
colorNew Color value with alpha; RGB may exceed 1.
PickerCreatedEvent
public event Action PickerCreated;One-time creation of the internal popup and picker after applying initial settings. Can occur through GetPicker/GetPopup before the window opens; subscribe beforehand.
PopupClosedEvent
public event Action PopupClosed;The built-in window closed; no result argument is supplied. Does not confirm a color or replace ColorChanged, and is not emitted by hiding an already hidden window.
Theme properties
These are Theme resource keys, not C# properties. Use the matching Control GetTheme…() and AddTheme…Override() methods for each value type.
| Key and type | Description |
|---|---|
bgTexture2D | The background of the color preview rect on the button. |