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

PickerShapeType

picker_shape

0

bool

presets_enabled

true

bool

presets_visible

true

bool

raw_mode

false

Methods

void

add_preset ( Color color )

void

erase_preset ( Color color )

PackedColorArray

get_presets ( ) const

Theme Properties

int

h_width

30

int

label_width

10

int

margin

4

int

sv_height

256

int

sv_width

256

Texture2D

add_preset

Texture2D

bar_arrow

Texture2D

color_hue

Texture2D

overbright_indicator

Texture2D

picker_cursor

Texture2D

sample_bg

Texture2D

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.

Enumerations

enum PickerShapeType:

  • SHAPE_HSV_RECTANGLE = 0 --- HSV Color Model rectangle color space.

  • SHAPE_HSV_WHEEL = 1 --- HSV Color Model rectangle color space with a wheel.

  • SHAPE_VHS_CIRCLE = 2 --- HSV Color Model circle color space. Use Saturation as a radius.

  • SHAPE_OKHSL_CIRCLE = 3 --- HSL OK Color Model circle color space.

Property Descriptions

Default

Color(1, 1, 1, 1)

Setter

set_pick_color(value)

Getter

get_pick_color()

The currently selected color.


  • bool deferred_mode

Default

false

Setter

set_deferred_mode(value)

Getter

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).


Default

true

Setter

set_edit_alpha(value)

Getter

is_editing_alpha()

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


Default

false

Setter

set_hsv_mode(value)

Getter

is_hsv_mode()

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

Note: Cannot be enabled if raw mode is on.


Default

0

Setter

set_picker_shape(value)

Getter

get_picker_shape()

The shape of the color space view. See PickerShapeType.


  • bool presets_enabled

Default

true

Setter

set_presets_enabled(value)

Getter

are_presets_enabled()

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


  • bool presets_visible

Default

true

Setter

set_presets_visible(value)

Getter

are_presets_visible()

If true, saved color presets are visible.


Default

false

Setter

set_raw_mode(value)

Getter

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.


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

Theme Property Descriptions

Default

30

The width of the hue selection slider.


  • int label_width

Default

10


Default

4

The margin around the ColorPicker.


  • int sv_height

Default

256

The height of the saturation-value selection box.


Default

256

The width of the saturation-value selection box.


The icon for the "Add Preset" button.


The texture for the arrow grabber.


Custom texture for the hue selection slider on the right.


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




The icon for the screen color picker button.