ColorPicker.xml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="ColorPicker" inherits="BoxContainer" version="4.0">
  3. <brief_description>
  4. Color picker control.
  5. </brief_description>
  6. <description>
  7. Displays a color picker widget. Useful for selecting a color from an RGB/RGBA colorspace.
  8. [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.
  9. </description>
  10. <tutorials>
  11. <link title="Tween Demo">https://godotengine.org/asset-library/asset/146</link>
  12. </tutorials>
  13. <methods>
  14. <method name="add_preset">
  15. <return type="void" />
  16. <argument index="0" name="color" type="Color" />
  17. <description>
  18. 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.
  19. [b]Note:[/b] The presets list is only for [i]this[/i] color picker.
  20. </description>
  21. </method>
  22. <method name="erase_preset">
  23. <return type="void" />
  24. <argument index="0" name="color" type="Color" />
  25. <description>
  26. Removes the given color from the list of color presets of this color picker.
  27. </description>
  28. </method>
  29. <method name="get_presets" qualifiers="const">
  30. <return type="PackedColorArray" />
  31. <description>
  32. Returns the list of colors in the presets of the color picker.
  33. </description>
  34. </method>
  35. </methods>
  36. <members>
  37. <member name="color" type="Color" setter="set_pick_color" getter="get_pick_color" default="Color(1, 1, 1, 1)">
  38. The currently selected color.
  39. </member>
  40. <member name="deferred_mode" type="bool" setter="set_deferred_mode" getter="is_deferred_mode" default="false">
  41. 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).
  42. </member>
  43. <member name="edit_alpha" type="bool" setter="set_edit_alpha" getter="is_editing_alpha" default="true">
  44. If [code]true[/code], shows an alpha channel slider (transparency).
  45. </member>
  46. <member name="hsv_mode" type="bool" setter="set_hsv_mode" getter="is_hsv_mode" default="false">
  47. If [code]true[/code], allows editing the color with Hue/Saturation/Value sliders.
  48. [b]Note:[/b] Cannot be enabled if raw mode is on.
  49. </member>
  50. <member name="picker_shape" type="int" setter="set_picker_shape" getter="get_picker_shape" enum="ColorPicker.PickerShapeType" default="0">
  51. The shape of the color space view. See [enum PickerShapeType].
  52. </member>
  53. <member name="presets_enabled" type="bool" setter="set_presets_enabled" getter="are_presets_enabled" default="true">
  54. If [code]true[/code], the "add preset" button is enabled.
  55. </member>
  56. <member name="presets_visible" type="bool" setter="set_presets_visible" getter="are_presets_visible" default="true">
  57. If [code]true[/code], saved color presets are visible.
  58. </member>
  59. <member name="raw_mode" type="bool" setter="set_raw_mode" getter="is_raw_mode" default="false">
  60. If [code]true[/code], 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).
  61. [b]Note:[/b] Cannot be enabled if HSV mode is on.
  62. </member>
  63. </members>
  64. <signals>
  65. <signal name="color_changed">
  66. <argument index="0" name="color" type="Color" />
  67. <description>
  68. Emitted when the color is changed.
  69. </description>
  70. </signal>
  71. <signal name="preset_added">
  72. <argument index="0" name="color" type="Color" />
  73. <description>
  74. Emitted when a preset is added.
  75. </description>
  76. </signal>
  77. <signal name="preset_removed">
  78. <argument index="0" name="color" type="Color" />
  79. <description>
  80. Emitted when a preset is removed.
  81. </description>
  82. </signal>
  83. </signals>
  84. <constants>
  85. <constant name="SHAPE_HSV_RECTANGLE" value="0" enum="PickerShapeType">
  86. HSV Color Model rectangle color space.
  87. </constant>
  88. <constant name="SHAPE_HSV_WHEEL" value="1" enum="PickerShapeType">
  89. HSV Color Model rectangle color space with a wheel.
  90. </constant>
  91. <constant name="SHAPE_VHS_CIRCLE" value="2" enum="PickerShapeType">
  92. HSV Color Model circle color space. Use Saturation as a radius.
  93. </constant>
  94. </constants>
  95. <theme_items>
  96. <theme_item name="add_preset" data_type="icon" type="Texture2D">
  97. The icon for the "Add Preset" button.
  98. </theme_item>
  99. <theme_item name="bar_arrow" data_type="icon" type="Texture2D">
  100. The texture for the arrow grabber.
  101. </theme_item>
  102. <theme_item name="color_hue" data_type="icon" type="Texture2D">
  103. Custom texture for the hue selection slider on the right.
  104. </theme_item>
  105. <theme_item name="color_sample" data_type="icon" type="Texture2D">
  106. </theme_item>
  107. <theme_item name="h_width" data_type="constant" type="int" default="30">
  108. The width of the hue selection slider.
  109. </theme_item>
  110. <theme_item name="label_width" data_type="constant" type="int" default="10">
  111. </theme_item>
  112. <theme_item name="margin" data_type="constant" type="int" default="4">
  113. The margin around the [ColorPicker].
  114. </theme_item>
  115. <theme_item name="overbright_indicator" data_type="icon" type="Texture2D">
  116. The indicator used to signalize that the color value is outside the 0-1 range.
  117. </theme_item>
  118. <theme_item name="picker_cursor" data_type="icon" type="Texture2D">
  119. </theme_item>
  120. <theme_item name="sample_bg" data_type="icon" type="Texture2D">
  121. </theme_item>
  122. <theme_item name="screen_picker" data_type="icon" type="Texture2D">
  123. The icon for the screen color picker button.
  124. </theme_item>
  125. <theme_item name="sv_height" data_type="constant" type="int" default="256">
  126. The height of the saturation-value selection box.
  127. </theme_item>
  128. <theme_item name="sv_width" data_type="constant" type="int" default="256">
  129. The width of the saturation-value selection box.
  130. </theme_item>
  131. </theme_items>
  132. </class>