ColorPicker

Inherits: BoxContainer < Container < Control < CanvasItem < Node < Object

Color picker control.

Description

Control node displaying a color picker widget. It’s useful for selecting a color from an RGB/RGBA colorspace.

Tutorials

Properties

ColorcolorColor( 1, 1, 1, 1 )
booldeferred_modefalse
booledit_alphatrue
boolhsv_modefalse
boolpresets_enabledtrue
boolpresets_visibletrue
boolraw_modefalse

Methods

voidadd_preset ( Color color )
voiderase_preset ( Color color )
PoolColorArrayget_presets ( ) const

Theme Properties

Textureadd_preset 
Texturecolor_hue 
Texturecolor_sample 
inth_width30
intlabel_width10
intmargin4
Textureoverbright_indicator 
Texturepreset_bg 
Texturescreen_picker 
intsv_height256
intsv_width256

Signals

  • color_changed ( Color color )

Emitted when the color is changed.


  • preset_added ( Color color )

Emitted when a preset is added.


  • preset_removed ( Color color )

Emitted when a preset is removed.

Property Descriptions

DefaultColor( 1, 1, 1, 1 )
Setterset_pick_color(value)
Getterget_pick_color()

The currently selected color.


Defaultfalse
Setterset_deferred_mode(value)
Getteris_deferred_mode()

If true, the color will apply only after the user releases the mouse button, otherwise it will apply immediately even in mouse motion event (which can cause performance issues).


Defaulttrue
Setterset_edit_alpha(value)
Getteris_editing_alpha()

If true, shows an alpha channel slider (transparency).


Defaultfalse
Setterset_hsv_mode(value)
Getteris_hsv_mode()

If true, allows editing the color with Hue/Saturation/Value sliders.

Note: Cannot be enabled if raw mode is on.


  • bool presets_enabled
Defaulttrue
Setterset_presets_enabled(value)
Getterare_presets_enabled()

If true, the “add preset” button is enabled.


  • bool presets_visible
Defaulttrue
Setterset_presets_visible(value)
Getterare_presets_visible()

If true, saved color presets are visible.


Defaultfalse
Setterset_raw_mode(value)
Getteris_raw_mode()

If true, allows the color R, G, B component values to go beyond 1.0, which can be used for certain special operations that require it (like tinting without darkening or rendering sprites in HDR).

Note: Cannot be enabled if HSV mode is on.

Method Descriptions

  • void add_preset ( Color color )

Adds the given color to a list of color presets. The presets are displayed in the color picker and the user will be able to select them.

Note: the presets list is only for this color picker.


  • void erase_preset ( Color color )

Removes the given color from the list of color presets of this color picker.


Returns the list of colors in the presets of the color picker.