ColorPicker
Embedded color editing panel with editing modes, presets and a separate recent-color history.
ColorPicker is the panel itself, without a separate popup or OK/cancel result. Embed it in your interface or use ColorPickerButton for a ready-made button and window. Set the value through Color and receive user edits through ColorChanged. The programmatic Color setter emits no signal; call your model update explicitly from code.
ColorMode selects the component representation; PickerShape selects the picking area shape. They are separate settings and switching them does not convert the stored value. Choose RGB/HSV/Linear/OKHSL for the user’s task; changing mode does not set the project or texture color space.
EditAlpha and EditIntensity control editing rather than clearing components: hiding alpha retains transparency, and disabling intensity does not clamp an assigned HDR color. SlidersVisible, HexVisible, ColorModesVisible, PresetsVisible and SamplerVisible hide their UI sections without deleting the color or presets. HexVisible concerns the text-input section rather than the storage format.
DeferredMode postpones drag notifications until the gesture ends; the internal color/preview can change earlier. This is not a transaction, asynchronous task or confirmation. Text entry and preset selection need not wait for a drag to end. For your own Apply/Cancel flow, retain the original color and control writes to the model separately.
AddPreset adds a unique color to the palette; adding it again moves it to the end. ErasePreset removes the matching value. These programmatic operations emit neither PresetAdded nor PresetRemoved: those signals concern UI actions. Persist the palette yourself if it must survive an application restart; the control’s list is not project storage. GetPresets and GetRecentPresets return Color[] snapshots; editing them does not change the palette.
Recent colors are a separate bounded history. AddRecentPreset for an existing color can change the current color and emit ColorChanged through internal swatch selection; do not assume it is always a silent history write. Do not rely on stable indices, history capacity or visual button order. Keep your own list for an exact controlled history. CanAddSwatches = false disables user addition/removal rather than prohibiting AddPreset/ErasePreset calls from code.
The eyedropper depends on the platform, permissions and available screen-capture method. Showing its UI does not guarantee reading colors from other applications. Do not start screen picking automatically when creating the panel.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
ColorPickerConstructor
public ColorPicker();Creates a panel with white color, RGB mode, HsvRectangle shape, editing UI enabled and DeferredMode = false.
Properties12
CanAddSwatchesProperty
public bool CanAddSwatches { get; set; }Allows user addition and removal of swatches, default true. Does not make Color read-only or block programmatic palette methods.
ColorProperty
public Color Color { get; set; }Current Color value including alpha and HDR components. Programmatic assignment updates the panel without ColorChanged. A value rather than confirmation or an automatic material write.
ColorModeProperty
public ColorPicker.ColorModeType ColorMode { get; set; }Component representation: Rgb, Hsv, Linear or Okhsl. Default Rgb. Switching retains Color rather than setting the project color space. Use Linear instead of legacy Raw.
ColorModesVisibleProperty
public bool ColorModesVisible { get; set; }Show mode-switching UI, default true. false neither changes the current ColorMode nor blocks its programmatic setter.
DeferredModeProperty
public bool DeferredMode { get; set; }Postpone drag ColorChanged notifications until release, default false. Color can change during dragging; this provides neither rollback nor general suppression of text/preset signals. Programmatic Color remains silent.
EditAlphaProperty
public bool EditAlpha { get; set; }Enables alpha editing, default true. false hides alpha controls while retaining the current transparency.
EditIntensityProperty
public bool EditIntensity { get; set; }Enables separate intensity editing, default true. false neither clamps stored HDR components to 1 nor disables scene glow.
HexVisibleProperty
public bool HexVisible { get; set; }Show the color text-input section, default true. UI visibility rather than forcing HEX storage of Color.
PickerShapeProperty
public ColorPicker.PickerShapeType PickerShape { get; set; }Picking area shape, default HsvRectangle. None hides the area and shape-selection button rather than removing Color or other editing controls.
PresetsVisibleProperty
public bool PresetsVisible { get; set; }Show palette and recent-color sections, default true. false retains the lists and access through GetPresets/GetRecentPresets.
SamplerVisibleProperty
public bool SamplerVisible { get; set; }Show the sample/eyedropper section, default true. Does not start screen capture or guarantee permissions/platform support.
SlidersVisibleProperty
public bool SlidersVisible { get; set; }Show the component-slider section, default true. Hiding it does not change Color.
Methods30
AddPresetvoid
public void AddPreset(Color color);Adds a palette color; an exact duplicate moves the existing swatch to the end without duplication. Does not change Color or emit PresetAdded. Works with CanAddSwatches = false; implement persistence separately.
| Name | Type | Default |
|---|---|---|
color | Color | — |
colorColor value with alpha; swatch equality includes all components.
AddRecentPresetvoid
public void AddRecentPreset(Color color);Adds a color to bounded recent history. Repeating an existing swatch can move it to the end, select that color and emit ColorChanged through an internal handler. Not a guaranteed silent history write.
| Name | Type | Default |
|---|---|---|
color | Color | — |
colorColor value with alpha; swatch equality includes all components.
AreModesVisiblebool
public bool AreModesVisible();Show mode-switching UI, default true. false neither changes the current ColorMode nor blocks its programmatic setter.
boolShow mode-switching UI, default true. false neither changes the current ColorMode nor blocks its programmatic setter.
ArePresetsVisiblebool
public bool ArePresetsVisible();Show palette and recent-color sections, default true. false retains the lists and access through GetPresets/GetRecentPresets.
boolShow palette and recent-color sections, default true. false retains the lists and access through GetPresets/GetRecentPresets.
AreSlidersVisiblebool
public bool AreSlidersVisible();Show the component-slider section, default true. Hiding it does not change Color.
boolShow the component-slider section, default true. Hiding it does not change Color.
AreSwatchesEnabledbool
public bool AreSwatchesEnabled();Allows user addition and removal of swatches, default true. Does not make Color read-only or block programmatic palette methods.
boolAllows user addition and removal of swatches, default true. Does not make Color read-only or block programmatic palette methods.
ErasePresetvoid
public void ErasePreset(Color color);Removes a matching palette color; missing values are ignored. Emits no PresetRemoved; CanAddSwatches does not prohibit programmatic removal.
| Name | Type | Default |
|---|---|---|
color | Color | — |
colorColor value with alpha; swatch equality includes all components.
EraseRecentPresetvoid
public void EraseRecentPreset(Color color);Removes a matching recent-history value; missing values are ignored. Emits no PresetRemoved; this list is separate from the palette.
| Name | Type | Default |
|---|---|---|
color | Color | — |
colorColor value with alpha; swatch equality includes all components.
GetColorModeColorPicker.ColorModeType
public ColorPicker.ColorModeType GetColorMode();Component representation: Rgb, Hsv, Linear or Okhsl. Default Rgb. Switching retains Color rather than setting the project color space. Use Linear instead of legacy Raw.
ColorPicker.ColorModeTypeComponent representation: Rgb, Hsv, Linear or Okhsl. Default Rgb. Switching retains Color rather than setting the project color space. Use Linear instead of legacy Raw.
GetPickColorColor
public Color GetPickColor();Current Color value including alpha and HDR components. Programmatic assignment updates the panel without ColorChanged. A value rather than confirmation or an automatic material write.
ColorCurrent Color value including alpha and HDR components. Programmatic assignment updates the panel without ColorChanged. A value rather than confirmation or an automatic material write.
GetPickerShapeColorPicker.PickerShapeType
public ColorPicker.PickerShapeType GetPickerShape();Picking area shape, default HsvRectangle. None hides the area and shape-selection button rather than removing Color or other editing controls.
ColorPicker.PickerShapeTypePicking area shape, default HsvRectangle. None hides the area and shape-selection button rather than removing Color or other editing controls.
GetPresetsColor[]
public Color[] GetPresets();Returns an independent Color[] in palette-list order. Editing the array does not change the control. Indices can change after additions/removals/repeated colors.
Color[]Returns an independent Color[] in palette-list order. Editing the array does not change the control. Indices can change after additions/removals/repeated colors.
GetRecentPresetsColor[]
public Color[] GetRecentPresets();Returns an independent history Color[], not a guaranteed visual button order. History is bounded and does not replace application palette persistence.
Color[]Returns an independent history Color[], not a guaranteed visual button order. History is bounded and does not replace application palette persistence.
IsDeferredModebool
public bool IsDeferredMode();Postpone drag ColorChanged notifications until release, default false. Color can change during dragging; this provides neither rollback nor general suppression of text/preset signals. Programmatic Color remains silent.
boolPostpone drag ColorChanged notifications until release, default false. Color can change during dragging; this provides neither rollback nor general suppression of text/preset signals. Programmatic Color remains silent.
IsEditingAlphabool
public bool IsEditingAlpha();Enables alpha editing, default true. false hides alpha controls while retaining the current transparency.
boolEnables alpha editing, default true. false hides alpha controls while retaining the current transparency.
IsEditingIntensitybool
public bool IsEditingIntensity();Enables separate intensity editing, default true. false neither clamps stored HDR components to 1 nor disables scene glow.
boolEnables separate intensity editing, default true. false neither clamps stored HDR components to 1 nor disables scene glow.
IsHexVisiblebool
public bool IsHexVisible();Show the color text-input section, default true. UI visibility rather than forcing HEX storage of Color.
boolShow the color text-input section, default true. UI visibility rather than forcing HEX storage of Color.
IsSamplerVisiblebool
public bool IsSamplerVisible();Show the sample/eyedropper section, default true. Does not start screen capture or guarantee permissions/platform support.
boolShow the sample/eyedropper section, default true. Does not start screen capture or guarantee permissions/platform support.
SetCanAddSwatchesvoid
public void SetCanAddSwatches(bool enabled);Allows user addition and removal of swatches, default true. Does not make Color read-only or block programmatic palette methods.
| Name | Type | Default |
|---|---|---|
enabled | bool | — |
enabledAllows user addition and removal of swatches, default true. Does not make Color read-only or block programmatic palette methods.
SetColorModevoid
public void SetColorMode(ColorPicker.ColorModeType colorMode);Component representation: Rgb, Hsv, Linear or Okhsl. Default Rgb. Switching retains Color rather than setting the project color space. Use Linear instead of legacy Raw.
| Name | Type | Default |
|---|---|---|
colorMode | ColorPicker.ColorModeType | — |
colorModeValid ColorModeType; use Linear rather than Raw.
SetDeferredModevoid
public void SetDeferredMode(bool mode);Postpone drag ColorChanged notifications until release, default false. Color can change during dragging; this provides neither rollback nor general suppression of text/preset signals. Programmatic Color remains silent.
| Name | Type | Default |
|---|---|---|
mode | bool | — |
modePostpone drag ColorChanged notifications until release, default false. Color can change during dragging; this provides neither rollback nor general suppression of text/preset signals. Programmatic Color remains silent.
SetEditAlphavoid
public void SetEditAlpha(bool show);Enables alpha editing, default true. false hides alpha controls while retaining the current transparency.
| Name | Type | Default |
|---|---|---|
show | bool | — |
showEnables alpha editing, default true. false hides alpha controls while retaining the current transparency.
SetEditIntensityvoid
public void SetEditIntensity(bool show);Enables separate intensity editing, default true. false neither clamps stored HDR components to 1 nor disables scene glow.
| Name | Type | Default |
|---|---|---|
show | bool | — |
showEnables separate intensity editing, default true. false neither clamps stored HDR components to 1 nor disables scene glow.
SetHexVisiblevoid
public void SetHexVisible(bool visible);Show the color text-input section, default true. UI visibility rather than forcing HEX storage of Color.
| Name | Type | Default |
|---|---|---|
visible | bool | — |
visibleShow the color text-input section, default true. UI visibility rather than forcing HEX storage of Color.
SetModesVisiblevoid
public void SetModesVisible(bool visible);Show mode-switching UI, default true. false neither changes the current ColorMode nor blocks its programmatic setter.
| Name | Type | Default |
|---|---|---|
visible | bool | — |
visibleShow mode-switching UI, default true. false neither changes the current ColorMode nor blocks its programmatic setter.
SetPickColorvoid
public void SetPickColor(Color color);Current Color value including alpha and HDR components. Programmatic assignment updates the panel without ColorChanged. A value rather than confirmation or an automatic material write.
| Name | Type | Default |
|---|---|---|
color | Color | — |
colorColor value with alpha; swatch equality includes all components.
SetPickerShapevoid
public void SetPickerShape(ColorPicker.PickerShapeType shape);Picking area shape, default HsvRectangle. None hides the area and shape-selection button rather than removing Color or other editing controls.
| Name | Type | Default |
|---|---|---|
shape | ColorPicker.PickerShapeType | — |
shapeValid PickerShapeType; None hides the picking area.
SetPresetsVisiblevoid
public void SetPresetsVisible(bool visible);Show palette and recent-color sections, default true. false retains the lists and access through GetPresets/GetRecentPresets.
| Name | Type | Default |
|---|---|---|
visible | bool | — |
visibleShow palette and recent-color sections, default true. false retains the lists and access through GetPresets/GetRecentPresets.
SetSamplerVisiblevoid
public void SetSamplerVisible(bool visible);Show the sample/eyedropper section, default true. Does not start screen capture or guarantee permissions/platform support.
| Name | Type | Default |
|---|---|---|
visible | bool | — |
visibleShow the sample/eyedropper section, default true. Does not start screen capture or guarantee permissions/platform support.
SetSlidersVisiblevoid
public void SetSlidersVisible(bool visible);Show the component-slider section, default true. Hiding it does not change Color.
| Name | Type | Default |
|---|---|---|
visible | bool | — |
visibleShow the component-slider section, default true. Hiding it does not change Color.
Signals and events3
ColorChangedEvent
public event ColorPicker.ColorChangedEventHandler ColorChanged;Change from interactive editing; programmatic Color does not emit it. Can also arrive through internal selection on repeated AddRecentPreset. DeferredMode delays drag notifications rather than confirming a choice.
| Name | Type | Default |
|---|---|---|
color | Color | — |
colorColor value with alpha; swatch equality includes all components.
PresetAddedEvent
public event ColorPicker.PresetAddedEventHandler PresetAdded;The user added a palette swatch through the UI. Direct AddPreset does not emit this signal; explicitly call your persistence logic for code-driven changes.
| Name | Type | Default |
|---|---|---|
color | Color | — |
colorColor value with alpha; swatch equality includes all components.
PresetRemovedEvent
public event ColorPicker.PresetRemovedEventHandler PresetRemoved;The user removed a swatch through the UI with CanAddSwatches allowed. Direct ErasePreset/EraseRecentPreset calls do not emit it.
| Name | Type | Default |
|---|---|---|
color | Color | — |
colorColor value with alpha; swatch equality includes all components.
ColorPicker.ColorModeType
| Value | Description |
|---|---|
Hsv = 1 | Allows editing the color with Hue/Saturation/Value sliders. |
Linear = 2 | Allows editing the color with Red/Green/Blue sliders in linear color space. |
Okhsl = 3 | Allows editing the color with Hue/Saturation/Lightness sliders. OKHSL is a new color space similar to HSL but that better match perception by leveraging the Oklab color space which is designed to be simple to use, while doing a good job at predicting perceived lightness, chroma and hue. Okhsv and Okhsl color spaces |
Raw = 2 | |
Rgb = 0 | Allows editing the color with Red/Green/Blue sliders in sRGB color space. |
ColorPicker.PickerShapeType
| Value | Description |
|---|---|
HsvRectangle = 0 | HSV Color Model rectangle color space. |
HsvWheel = 1 | HSV Color Model rectangle color space with a wheel. |
None = 4 | The color space shape and the shape select button are hidden. Can't be selected from the shapes popup. |
OkHlRectangle = 6 | OKHSL Color Model rectangle with constant saturation. |
OkHsRectangle = 5 | OKHSL Color Model rectangle with constant lightness. |
OkhslCircle = 3 | HSL OK Color Model circle color space. |
VhsCircle = 2 | HSV Color Model circle color space. Use Saturation as a radius. |
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 |
|---|---|
focused_not_editing_cursor_colorColor | Color of rectangle or circle drawn when a picker shape part is focused but not editable via keyboard or joypad. Displayed over the picker shape, so a partially transparent color should be used to ensure the picker shape remains visible. Default:Color(1, 1, 1, 0.275) |
center_slider_grabbersint | Overrides the 1 |
h_widthint | The width of the hue selection slider. Default:30 |
label_widthint | The minimum width of the color labels next to sliders. Default:10 |
marginint | The margin around the 4 |
sv_heightint | The height of the saturation-value selection box. Default:256 |
sv_widthint | The width of the saturation-value selection box. Default:256 |
add_presetTexture2D | The icon for the "Add Preset" button. |
bar_arrowTexture2D | The texture for the arrow grabber. |
color_copyTexture2D | The icon for the button that copies the color in text format to the clipboard. |
color_hueTexture2D | Custom texture for the hue selection slider on the right. |
color_scriptTexture2D | The icon for the button that switches color text to hexadecimal. |
expanded_arrowTexture2D | The icon for color preset drop down menu when expanded. |
folded_arrowTexture2D | The icon for color preset drop down menu when folded. |
menu_optionTexture2D | The icon for color preset option menu. |
overbright_indicatorTexture2D | The indicator used to signalize that the color value is outside the 0-1 range. |
picker_cursorTexture2D | The image displayed over the color box/circle (depending on the |
picker_cursor_bgTexture2D | The fill image displayed behind the picker cursor. |
sample_bgTexture2D | Background panel for the color preview box (visible when the color is translucent). |
sample_revertTexture2D | The icon for the revert button (visible on the middle of the "old" color when it differs from the currently selected color). This icon is modulated with a dark color if the "old" color is bright enough, so the icon should be bright to ensure visibility in both scenarios. |
screen_pickerTexture2D | The icon for the screen color picker button. |
shape_circleTexture2D | The icon for circular picker shapes. |
shape_rectTexture2D | The icon for rectangular picker shapes. |
shape_rect_wheelTexture2D | The icon for rectangular wheel picker shapes. |
picker_focus_circleStyleBox | The |
picker_focus_rectangleStyleBox | The |
sample_focusStyleBox | The |