2017-09-12 20:42:36 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-07-06 08:08:05 +00:00
<class name= "ColorPicker" inherits= "VBoxContainer" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2017-09-12 20:42:36 +00:00
<brief_description >
2023-04-30 14:26:09 +00:00
A widget that provides an interface for selecting or modifying a color.
2017-09-12 20:42:36 +00:00
</brief_description>
<description >
2023-04-30 14:26:09 +00:00
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.
[b]Note:[/b] 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.
2017-09-12 20:42:36 +00:00
</description>
<tutorials >
2020-10-01 08:34:47 +00:00
<link title= "Tween Demo" > https://godotengine.org/asset-library/asset/146</link>
2017-09-12 20:42:36 +00:00
</tutorials>
<methods >
<method name= "add_preset" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "color" type= "Color" />
2017-09-12 20:42:36 +00:00
<description >
2019-06-21 23:04:47 +00:00
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.
2021-10-05 12:24:34 +00:00
[b]Note:[/b] The presets list is only for [i]this[/i] color picker.
2017-09-12 20:42:36 +00:00
</description>
</method>
2022-06-30 11:34:32 +00:00
<method name= "add_recent_preset" >
<return type= "void" />
<param index= "0" name= "color" type= "Color" />
<description >
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.
[b]Note:[/b] The recent presets list is only for [i]this[/i] color picker.
</description>
</method>
2018-10-03 14:12:38 +00:00
<method name= "erase_preset" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "color" type= "Color" />
2018-10-03 14:12:38 +00:00
<description >
2019-06-21 23:04:47 +00:00
Removes the given color from the list of color presets of this color picker.
2018-10-03 14:12:38 +00:00
</description>
</method>
2022-06-30 11:34:32 +00:00
<method name= "erase_recent_preset" >
<return type= "void" />
<param index= "0" name= "color" type= "Color" />
<description >
Removes the given color from the list of color recent presets of this color picker.
</description>
</method>
2018-12-13 14:12:25 +00:00
<method name= "get_presets" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "PackedColorArray" />
2018-10-03 14:12:38 +00:00
<description >
2019-05-24 02:15:43 +00:00
Returns the list of colors in the presets of the color picker.
2018-10-03 14:12:38 +00:00
</description>
</method>
2022-06-30 11:34:32 +00:00
<method name= "get_recent_presets" qualifiers= "const" >
<return type= "PackedColorArray" />
<description >
Returns the list of colors in the recent presets of the color picker.
</description>
</method>
2017-09-12 20:42:36 +00:00
</methods>
2018-01-11 22:38:35 +00:00
<members >
2022-10-22 03:20:28 +00:00
<member name= "can_add_swatches" type= "bool" setter= "set_can_add_swatches" getter= "are_swatches_enabled" default= "true" >
If [code]true[/code], it's possible to add presets under Swatches. If [code]false[/code], the button to add presets is disabled.
</member>
2019-09-24 17:45:03 +00:00
<member name= "color" type= "Color" setter= "set_pick_color" getter= "get_pick_color" default= "Color(1, 1, 1, 1)" >
2018-01-11 22:38:35 +00:00
The currently selected color.
</member>
2022-05-29 15:17:37 +00:00
<member name= "color_mode" type= "int" setter= "set_color_mode" getter= "get_color_mode" enum= "ColorPicker.ColorModeType" default= "0" >
The currently selected color mode. See [enum ColorModeType].
</member>
2022-10-22 03:20:28 +00:00
<member name= "color_modes_visible" type= "bool" setter= "set_modes_visible" getter= "are_modes_visible" default= "true" >
If [code]true[/code], the color mode buttons are visible.
</member>
2019-06-29 10:38:01 +00:00
<member name= "deferred_mode" type= "bool" setter= "set_deferred_mode" getter= "is_deferred_mode" default= "false" >
2018-12-20 12:46:54 +00:00
If [code]true[/code], 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).
2018-07-26 09:56:21 +00:00
</member>
2019-06-29 10:38:01 +00:00
<member name= "edit_alpha" type= "bool" setter= "set_edit_alpha" getter= "is_editing_alpha" default= "true" >
2021-12-24 08:45:09 +00:00
If [code]true[/code], shows an alpha channel slider (opacity).
2018-01-11 22:38:35 +00:00
</member>
2022-10-22 03:20:28 +00:00
<member name= "hex_visible" type= "bool" setter= "set_hex_visible" getter= "is_hex_visible" default= "true" >
If [code]true[/code], the hex color code input field is visible.
</member>
2021-04-19 10:26:37 +00:00
<member name= "picker_shape" type= "int" setter= "set_picker_shape" getter= "get_picker_shape" enum= "ColorPicker.PickerShapeType" default= "0" >
2021-02-23 10:22:46 +00:00
The shape of the color space view. See [enum PickerShapeType].
</member>
2019-06-29 10:38:01 +00:00
<member name= "presets_visible" type= "bool" setter= "set_presets_visible" getter= "are_presets_visible" default= "true" >
2022-10-22 03:20:28 +00:00
If [code]true[/code], the Swatches and Recent Colors presets are visible.
</member>
<member name= "sampler_visible" type= "bool" setter= "set_sampler_visible" getter= "is_sampler_visible" default= "true" >
If [code]true[/code], the color sampler and color preview are visible.
</member>
<member name= "sliders_visible" type= "bool" setter= "set_sliders_visible" getter= "are_sliders_visible" default= "true" >
If [code]true[/code], the color sliders are visible.
2019-06-24 08:39:59 +00:00
</member>
2018-01-11 22:38:35 +00:00
</members>
2017-09-12 20:42:36 +00:00
<signals >
<signal name= "color_changed" >
2022-08-06 18:11:48 +00:00
<param index= "0" name= "color" type= "Color" />
2017-09-12 20:42:36 +00:00
<description >
Emitted when the color is changed.
</description>
</signal>
2018-10-03 14:12:38 +00:00
<signal name= "preset_added" >
2022-08-06 18:11:48 +00:00
<param index= "0" name= "color" type= "Color" />
2018-10-03 14:12:38 +00:00
<description >
Emitted when a preset is added.
</description>
</signal>
<signal name= "preset_removed" >
2022-08-06 18:11:48 +00:00
<param index= "0" name= "color" type= "Color" />
2018-10-03 14:12:38 +00:00
<description >
Emitted when a preset is removed.
</description>
</signal>
</signals>
2017-09-12 20:42:36 +00:00
<constants >
2022-05-29 15:17:37 +00:00
<constant name= "MODE_RGB" value= "0" enum= "ColorModeType" >
Allows editing the color with Red/Green/Blue sliders.
</constant>
<constant name= "MODE_HSV" value= "1" enum= "ColorModeType" >
Allows editing the color with Hue/Saturation/Value sliders.
</constant>
<constant name= "MODE_RAW" value= "2" enum= "ColorModeType" >
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).
</constant>
<constant name= "MODE_OKHSL" value= "3" enum= "ColorModeType" >
Allows editing the color with Hue/Saturation/Lightness sliders.
OKHSL is a new color space similar to HSL but that better match perception by leveraging the Oklab color space which is designed to be simple to use, while doing a good job at predicting perceived lightness, chroma and hue.
[url=https://bottosson.github.io/posts/colorpicker/]Okhsv and Okhsl color spaces[/url]
</constant>
2021-02-23 10:22:46 +00:00
<constant name= "SHAPE_HSV_RECTANGLE" value= "0" enum= "PickerShapeType" >
HSV Color Model rectangle color space.
</constant>
<constant name= "SHAPE_HSV_WHEEL" value= "1" enum= "PickerShapeType" >
HSV Color Model rectangle color space with a wheel.
</constant>
<constant name= "SHAPE_VHS_CIRCLE" value= "2" enum= "PickerShapeType" >
HSV Color Model circle color space. Use Saturation as a radius.
</constant>
2022-04-18 18:29:29 +00:00
<constant name= "SHAPE_OKHSL_CIRCLE" value= "3" enum= "PickerShapeType" >
HSL OK Color Model circle color space.
</constant>
2022-10-22 03:20:28 +00:00
<constant name= "SHAPE_NONE" value= "4" enum= "PickerShapeType" >
The color space shape and the shape select button are hidden. Can't be selected from the shapes popup.
</constant>
2017-09-12 20:42:36 +00:00
</constants>
<theme_items >
2022-11-23 13:56:10 +00:00
<theme_item name= "center_slider_grabbers" data_type= "constant" type= "int" default= "1" >
Overrides the [theme_item HSlider.center_grabber] theme property of the sliders.
</theme_item>
2021-12-01 18:02:20 +00:00
<theme_item name= "h_width" data_type= "constant" type= "int" default= "30" >
The width of the hue selection slider.
</theme_item>
<theme_item name= "label_width" data_type= "constant" type= "int" default= "10" >
2022-10-06 19:59:48 +00:00
The minimum width of the color labels next to sliders.
2021-12-01 18:02:20 +00:00
</theme_item>
<theme_item name= "margin" data_type= "constant" type= "int" default= "4" >
The margin around the [ColorPicker].
</theme_item>
<theme_item name= "sv_height" data_type= "constant" type= "int" default= "256" >
The height of the saturation-value selection box.
</theme_item>
<theme_item name= "sv_width" data_type= "constant" type= "int" default= "256" >
The width of the saturation-value selection box.
</theme_item>
2021-08-04 16:54:41 +00:00
<theme_item name= "add_preset" data_type= "icon" type= "Texture2D" >
2020-03-03 18:21:21 +00:00
The icon for the "Add Preset" button.
2017-09-12 20:42:36 +00:00
</theme_item>
2021-08-04 16:54:41 +00:00
<theme_item name= "bar_arrow" data_type= "icon" type= "Texture2D" >
2021-02-17 05:30:56 +00:00
The texture for the arrow grabber.
</theme_item>
2021-08-04 16:54:41 +00:00
<theme_item name= "color_hue" data_type= "icon" type= "Texture2D" >
2020-03-03 18:21:21 +00:00
Custom texture for the hue selection slider on the right.
2017-09-12 20:42:36 +00:00
</theme_item>
2022-10-17 14:51:52 +00:00
<theme_item name= "color_okhsl_hue" data_type= "icon" type= "Texture2D" >
Custom texture for the H slider in the OKHSL color mode.
</theme_item>
2022-06-30 11:34:32 +00:00
<theme_item name= "expanded_arrow" data_type= "icon" type= "Texture2D" >
The icon for color preset drop down menu when expanded.
</theme_item>
<theme_item name= "folded_arrow" data_type= "icon" type= "Texture2D" >
The icon for color preset drop down menu when folded.
</theme_item>
2021-08-04 16:54:41 +00:00
<theme_item name= "overbright_indicator" data_type= "icon" type= "Texture2D" >
2020-03-03 18:21:21 +00:00
The indicator used to signalize that the color value is outside the 0-1 range.
2019-10-01 08:55:49 +00:00
</theme_item>
2021-08-04 16:54:41 +00:00
<theme_item name= "picker_cursor" data_type= "icon" type= "Texture2D" >
2022-10-06 19:59:48 +00:00
The image displayed over the color box/circle (depending on the [member picker_shape]), marking the currently selected color.
2021-04-19 10:26:37 +00:00
</theme_item>
2021-08-18 00:09:48 +00:00
<theme_item name= "sample_bg" data_type= "icon" type= "Texture2D" >
2022-10-06 19:59:48 +00:00
Background panel for the color preview box (visible when the color is translucent).
2017-10-11 21:54:43 +00:00
</theme_item>
2021-08-04 16:54:41 +00:00
<theme_item name= "screen_picker" data_type= "icon" type= "Texture2D" >
2020-03-03 18:21:21 +00:00
The icon for the screen color picker button.
2017-09-12 20:42:36 +00:00
</theme_item>
2022-06-30 11:34:32 +00:00
<theme_item name= "shape_circle" data_type= "icon" type= "Texture2D" >
The icon for circular picker shapes.
</theme_item>
<theme_item name= "shape_rect" data_type= "icon" type= "Texture2D" >
The icon for rectangular picker shapes.
</theme_item>
<theme_item name= "shape_rect_wheel" data_type= "icon" type= "Texture2D" >
The icon for rectangular wheel picker shapes.
</theme_item>
2017-09-12 20:42:36 +00:00
</theme_items>
</class>