summaryrefslogtreecommitdiff
path: root/doc/classes/ColorPicker.xml
blob: e992d6f9d47d651cfb9ba7d59527a745cf4d7194 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?xml version="1.0" encoding="UTF-8" ?>
<class name="ColorPicker" inherits="BoxContainer" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
	<brief_description>
		Color picker control.
	</brief_description>
	<description>
		Displays a color picker widget. Useful for selecting a color from an RGB/RGBA colorspace.
		[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 pop-up.
	</description>
	<tutorials>
		<link title="Tween Demo">https://godotengine.org/asset-library/asset/146</link>
	</tutorials>
	<methods>
		<method name="add_preset">
			<return type="void" />
			<param index="0" name="color" type="Color" />
			<description>
				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.
				[b]Note:[/b] The presets list is only for [i]this[/i] color picker.
			</description>
		</method>
		<method name="erase_preset">
			<return type="void" />
			<param index="0" name="color" type="Color" />
			<description>
				Removes the given color from the list of color presets of this color picker.
			</description>
		</method>
		<method name="get_presets" qualifiers="const">
			<return type="PackedColorArray" />
			<description>
				Returns the list of colors in the presets of the color picker.
			</description>
		</method>
	</methods>
	<members>
		<member name="color" type="Color" setter="set_pick_color" getter="get_pick_color" default="Color(1, 1, 1, 1)">
			The currently selected color.
		</member>
		<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>
		<member name="deferred_mode" type="bool" setter="set_deferred_mode" getter="is_deferred_mode" default="false">
			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).
		</member>
		<member name="edit_alpha" type="bool" setter="set_edit_alpha" getter="is_editing_alpha" default="true">
			If [code]true[/code], shows an alpha channel slider (opacity).
		</member>
		<member name="picker_shape" type="int" setter="set_picker_shape" getter="get_picker_shape" enum="ColorPicker.PickerShapeType" default="0">
			The shape of the color space view. See [enum PickerShapeType].
		</member>
		<member name="presets_enabled" type="bool" setter="set_presets_enabled" getter="are_presets_enabled" default="true">
			If [code]true[/code], the "add preset" button is enabled.
		</member>
		<member name="presets_visible" type="bool" setter="set_presets_visible" getter="are_presets_visible" default="true">
			If [code]true[/code], saved color presets are visible.
		</member>
		<member name="vertical" type="bool" setter="set_vertical" getter="is_vertical" overrides="BoxContainer" default="true" />
	</members>
	<signals>
		<signal name="color_changed">
			<param index="0" name="color" type="Color" />
			<description>
				Emitted when the color is changed.
			</description>
		</signal>
		<signal name="preset_added">
			<param index="0" name="color" type="Color" />
			<description>
				Emitted when a preset is added.
			</description>
		</signal>
		<signal name="preset_removed">
			<param index="0" name="color" type="Color" />
			<description>
				Emitted when a preset is removed.
			</description>
		</signal>
	</signals>
	<constants>
		<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>
		<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>
		<constant name="SHAPE_OKHSL_CIRCLE" value="3" enum="PickerShapeType">
			HSL OK Color Model circle color space.
		</constant>
	</constants>
	<theme_items>
		<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">
		</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>
		<theme_item name="add_preset" data_type="icon" type="Texture2D">
			The icon for the "Add Preset" button.
		</theme_item>
		<theme_item name="bar_arrow" data_type="icon" type="Texture2D">
			The texture for the arrow grabber.
		</theme_item>
		<theme_item name="color_hue" data_type="icon" type="Texture2D">
			Custom texture for the hue selection slider on the right.
		</theme_item>
		<theme_item name="overbright_indicator" data_type="icon" type="Texture2D">
			The indicator used to signalize that the color value is outside the 0-1 range.
		</theme_item>
		<theme_item name="picker_cursor" data_type="icon" type="Texture2D">
		</theme_item>
		<theme_item name="sample_bg" data_type="icon" type="Texture2D">
		</theme_item>
		<theme_item name="screen_picker" data_type="icon" type="Texture2D">
			The icon for the screen color picker button.
		</theme_item>
	</theme_items>
</class>