Table of Contents

Class ColorPicker

A widget that provides an interface for selecting or modifying a color.

Inheritance
ColorPicker

Remarks

A widget that provides an interface for selecting or modifying a color. It can optionally provide functionalities like a color sampler (eyedropper), color modes, and presets.

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

See Also

Properties

can_add_swatches

If true, it's possible to add presets under Swatches. If false, the button to add presets is disabled.

var can_add_swatches : bool = true

Property Value

bool

Remarks

  • void set_can_add_swatches(bool value)
  • bool are_swatches_enabled

color

The currently selected color.

var color : Color = Color(1, 1, 1, 1)

Property Value

Color

Remarks

  • void set_pick_color(Color value)
  • Color get_pick_color

color_mode

The currently selected color mode. See ColorModeType.

var color_mode : int = 0

Property Value

int

Remarks

  • void set_color_mode(int value)
  • int get_color_mode

color_modes_visible

If true, the color mode buttons are visible.

var color_modes_visible : bool = true

Property Value

bool

Remarks

  • void set_modes_visible(bool value)
  • bool are_modes_visible

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

var deferred_mode : bool = false

Property Value

bool

Remarks

  • void set_deferred_mode(bool value)
  • bool is_deferred_mode

edit_alpha

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

var edit_alpha : bool = true

Property Value

bool

Remarks

  • void set_edit_alpha(bool value)
  • bool is_editing_alpha

hex_visible

If true, the hex color code input field is visible.

var hex_visible : bool = true

Property Value

bool

Remarks

  • void set_hex_visible(bool value)
  • bool is_hex_visible

picker_shape

The shape of the color space view. See PickerShapeType.

var picker_shape : int = 0

Property Value

int

Remarks

  • void set_picker_shape(int value)
  • int get_picker_shape

presets_visible

If true, the Swatches and Recent Colors presets are visible.

var presets_visible : bool = true

Property Value

bool

Remarks

  • void set_presets_visible(bool value)
  • bool are_presets_visible

sampler_visible

If true, the color sampler and color preview are visible.

var sampler_visible : bool = true

Property Value

bool

Remarks

  • void set_sampler_visible(bool value)
  • bool is_sampler_visible

sliders_visible

If true, the color sliders are visible.

var sliders_visible : bool = true

Property Value

bool

Remarks

  • void set_sliders_visible(bool value)
  • bool are_sliders_visible

center_slider_grabbers

Theme Property

Overrides the center_grabber theme property of the sliders.

 = ``1``

Property Value

int

h_width

Theme Property

The width of the hue selection slider.

 = ``30``

Property Value

int

label_width

Theme Property

The minimum width of the color labels next to sliders.

 = ``10``

Property Value

int

margin

Theme Property

The margin around the ColorPicker.

 = ``4``

Property Value

int

sv_height

Theme Property

The height of the saturation-value selection box.

 = ``256``

Property Value

int

sv_width

Theme Property

The width of the saturation-value selection box.

 = ``256``

Property Value

int

add_preset

Theme Property

The icon for the "Add Preset" button.

Texture2D add_preset

Property Value

Texture2D

bar_arrow

Theme Property

The texture for the arrow grabber.

Texture2D bar_arrow

Property Value

Texture2D

color_hue

Theme Property

Custom texture for the hue selection slider on the right.

Texture2D color_hue

Property Value

Texture2D

expanded_arrow

Theme Property

The icon for color preset drop down menu when expanded.

Texture2D expanded_arrow

Property Value

Texture2D

folded_arrow

Theme Property

The icon for color preset drop down menu when folded.

Texture2D folded_arrow

Property Value

Texture2D

menu_option

Theme Property

The icon for color preset option menu.

Texture2D menu_option

Property Value

Texture2D

overbright_indicator

Theme Property

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

Texture2D overbright_indicator

Property Value

Texture2D

picker_cursor

Theme Property

The image displayed over the color box/circle (depending on the picker_shape), marking the currently selected color.

Texture2D picker_cursor

Property Value

Texture2D

picker_cursor_bg

Theme Property

The fill image displayed behind the picker cursor.

Texture2D picker_cursor_bg

Property Value

Texture2D

sample_bg

Theme Property

Background panel for the color preview box (visible when the color is translucent).

Texture2D sample_bg

Property Value

Texture2D

sample_revert

Theme Property

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.

Texture2D sample_revert

Property Value

Texture2D

screen_picker

Theme Property

The icon for the screen color picker button.

Texture2D screen_picker

Property Value

Texture2D

shape_circle

Theme Property

The icon for circular picker shapes.

Texture2D shape_circle

Property Value

Texture2D

shape_rect

Theme Property

The icon for rectangular picker shapes.

Texture2D shape_rect

Property Value

Texture2D

shape_rect_wheel

Theme Property

The icon for rectangular wheel picker shapes.

Texture2D shape_rect_wheel

Property Value

Texture2D

Methods

add_preset(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 add_preset(Color color)

Parameters

color Color

add_recent_preset(Color)

Adds the given color to a list of color recent presets so that it can be picked later. Recent presets are the colors that were picked recently, a new preset is automatically created and added to recent presets when you pick a new color.

Note: The recent presets list is only for this color picker.

void add_recent_preset(Color color)

Parameters

color Color

erase_preset(Color)

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

void erase_preset(Color color)

Parameters

color Color

erase_recent_preset(Color)

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

void erase_recent_preset(Color color)

Parameters

color Color

get_presets

Qualifiers: const

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

PackedColorArray get_presets

get_recent_presets

Qualifiers: const

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

PackedColorArray get_recent_presets

Events

color_changed(Color)

Emitted when the color is changed.

signal color_changed(Color color)

Parameters

color Color

preset_added(Color)

Emitted when a preset is added.

signal preset_added(Color color)

Parameters

color Color

preset_removed(Color)

Emitted when a preset is removed.

signal preset_removed(Color color)

Parameters

color Color