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
Remarks
color
The currently selected color.
var color : Color = Color(1, 1, 1, 1)
Property Value
Remarks
color_mode
The currently selected color mode. See ColorModeType.
var color_mode : int = 0
Property Value
Remarks
color_modes_visible
If true
, the color mode buttons are visible.
var color_modes_visible : bool = true
Property Value
Remarks
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
Remarks
edit_alpha
If true
, shows an alpha channel slider (opacity).
var edit_alpha : bool = true
Property Value
Remarks
hex_visible
If true
, the hex color code input field is visible.
var hex_visible : bool = true
Property Value
Remarks
picker_shape
The shape of the color space view. See PickerShapeType.
var picker_shape : int = 0
Property Value
Remarks
presets_visible
If true
, the Swatches and Recent Colors presets are visible.
var presets_visible : bool = true
Property Value
Remarks
sampler_visible
If true
, the color sampler and color preview are visible.
var sampler_visible : bool = true
Property Value
Remarks
sliders_visible
If true
, the color sliders are visible.
var sliders_visible : bool = true
Property Value
Remarks
center_slider_grabbers
Theme Property
Overrides the center_grabber theme property of the sliders.
= ``1``
Property Value
h_width
Theme Property
The width of the hue selection slider.
= ``30``
Property Value
label_width
Theme Property
The minimum width of the color labels next to sliders.
= ``10``
Property Value
margin
Theme Property
The margin around the ColorPicker.
= ``4``
Property Value
sv_height
Theme Property
The height of the saturation-value selection box.
= ``256``
Property Value
sv_width
Theme Property
The width of the saturation-value selection box.
= ``256``
Property Value
add_preset
Theme Property
The icon for the "Add Preset" button.
Texture2D add_preset
Property Value
bar_arrow
Theme Property
The texture for the arrow grabber.
Texture2D bar_arrow
Property Value
color_hue
Theme Property
Custom texture for the hue selection slider on the right.
Texture2D color_hue
Property Value
expanded_arrow
Theme Property
The icon for color preset drop down menu when expanded.
Texture2D expanded_arrow
Property Value
folded_arrow
Theme Property
The icon for color preset drop down menu when folded.
Texture2D folded_arrow
Property Value
menu_option
Theme Property
The icon for color preset option menu.
Texture2D menu_option
Property Value
overbright_indicator
Theme Property
The indicator used to signalize that the color value is outside the 0-1 range.
Texture2D overbright_indicator
Property Value
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
picker_cursor_bg
Theme Property
The fill image displayed behind the picker cursor.
Texture2D picker_cursor_bg
Property Value
sample_bg
Theme Property
Background panel for the color preview box (visible when the color is translucent).
Texture2D sample_bg
Property Value
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
screen_picker
Theme Property
The icon for the screen color picker button.
Texture2D screen_picker
Property Value
shape_circle
Theme Property
The icon for circular picker shapes.
Texture2D shape_circle
Property Value
shape_rect
Theme Property
The icon for rectangular picker shapes.
Texture2D shape_rect
Property Value
shape_rect_wheel
Theme Property
The icon for rectangular wheel picker shapes.
Texture2D shape_rect_wheel
Property Value
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