ColorPicker

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

Color picker control.

Description

Displays a color picker widget. Useful for selecting a color from an RGB/RGBA colorspace.

Note: This control is the color picker widget itself. You can use a ColorPickerButton instead if you need a button that brings up a ColorPicker in a pop-up.

Tutorials

Properties

Color

color

Color( 1, 1, 1, 1 )

bool

deferred_mode

false

bool

edit_alpha

true

bool

hsv_mode

false

bool

presets_enabled

true

bool

presets_visible

true

bool

raw_mode

false

Methods

void

add_preset ( Color color )

void

erase_preset ( Color color )

PoolColorArray

get_presets ( ) const

Theme Properties

int

h_width

30

int

label_width

10

int

margin

4

int

sv_height

256

int

sv_width

256

Texture

add_preset

Texture

color_hue

Texture

color_sample

Texture

overbright_indicator

Texture

preset_bg

Texture

screen_picker


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

Color color = Color( 1, 1, 1, 1 )

  • void set_pick_color ( Color value )

  • Color get_pick_color ( )

The currently selected color.


bool deferred_mode = false

  • void set_deferred_mode ( bool value )

  • bool is_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).


bool edit_alpha = true

  • void set_edit_alpha ( bool value )

  • bool is_editing_alpha ( )

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


bool hsv_mode = false

  • void set_hsv_mode ( bool value )

  • bool is_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 = true

  • void set_presets_enabled ( bool value )

  • bool are_presets_enabled ( )

If true, the "add preset" button is enabled.


bool presets_visible = true

  • void set_presets_visible ( bool value )

  • bool are_presets_visible ( )

If true, saved color presets are visible.


bool raw_mode = false

  • void set_raw_mode ( bool value )

  • bool is_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.


PoolColorArray get_presets ( ) const

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


Theme Property Descriptions

int h_width = 30

The width of the hue selection slider.


int label_width = 10

There is currently no description for this theme property. Please help us by contributing one!


int margin = 4

The margin around the ColorPicker.


int sv_height = 256

The height of the saturation-value selection box.


int sv_width = 256

The width of the saturation-value selection box.


Texture add_preset

The icon for the "Add Preset" button.


Texture color_hue

Custom texture for the hue selection slider on the right.


Texture color_sample

There is currently no description for this theme property. Please help us by contributing one!


Texture overbright_indicator

The indicator used to signalize that the color value is outside the 0-1 range.


Texture preset_bg

There is currently no description for this theme property. Please help us by contributing one!


Texture screen_picker

The icon for the screen color picker button.