class_colorpicker.rst 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the ColorPicker.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_ColorPicker:
  6. ColorPicker
  7. ===========
  8. **Inherits:** :ref:`BoxContainer<class_BoxContainer>` **<** :ref:`Container<class_Container>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. Color picker control.
  10. Description
  11. -----------
  12. :ref:`Control<class_Control>` node displaying a color picker widget. It's useful for selecting a color from an RGB/RGBA colorspace.
  13. Tutorials
  14. ---------
  15. - `Tween Demo <https://godotengine.org/asset-library/asset/146>`_
  16. Properties
  17. ----------
  18. +---------------------------+--------------------------------------------------------------------+-------------------------+
  19. | :ref:`Color<class_Color>` | :ref:`color<class_ColorPicker_property_color>` | ``Color( 1, 1, 1, 1 )`` |
  20. +---------------------------+--------------------------------------------------------------------+-------------------------+
  21. | :ref:`bool<class_bool>` | :ref:`deferred_mode<class_ColorPicker_property_deferred_mode>` | ``false`` |
  22. +---------------------------+--------------------------------------------------------------------+-------------------------+
  23. | :ref:`bool<class_bool>` | :ref:`edit_alpha<class_ColorPicker_property_edit_alpha>` | ``true`` |
  24. +---------------------------+--------------------------------------------------------------------+-------------------------+
  25. | :ref:`bool<class_bool>` | :ref:`hsv_mode<class_ColorPicker_property_hsv_mode>` | ``false`` |
  26. +---------------------------+--------------------------------------------------------------------+-------------------------+
  27. | :ref:`bool<class_bool>` | :ref:`presets_enabled<class_ColorPicker_property_presets_enabled>` | ``true`` |
  28. +---------------------------+--------------------------------------------------------------------+-------------------------+
  29. | :ref:`bool<class_bool>` | :ref:`presets_visible<class_ColorPicker_property_presets_visible>` | ``true`` |
  30. +---------------------------+--------------------------------------------------------------------+-------------------------+
  31. | :ref:`bool<class_bool>` | :ref:`raw_mode<class_ColorPicker_property_raw_mode>` | ``false`` |
  32. +---------------------------+--------------------------------------------------------------------+-------------------------+
  33. Methods
  34. -------
  35. +---------------------------------------------+--------------------------------------------------------------------------------------------------------+
  36. | void | :ref:`add_preset<class_ColorPicker_method_add_preset>` **(** :ref:`Color<class_Color>` color **)** |
  37. +---------------------------------------------+--------------------------------------------------------------------------------------------------------+
  38. | void | :ref:`erase_preset<class_ColorPicker_method_erase_preset>` **(** :ref:`Color<class_Color>` color **)** |
  39. +---------------------------------------------+--------------------------------------------------------------------------------------------------------+
  40. | :ref:`PoolColorArray<class_PoolColorArray>` | :ref:`get_presets<class_ColorPicker_method_get_presets>` **(** **)** |const| |
  41. +---------------------------------------------+--------------------------------------------------------------------------------------------------------+
  42. Theme Properties
  43. ----------------
  44. +-------------------------------+----------------------+-----+
  45. | :ref:`Texture<class_Texture>` | add_preset | |
  46. +-------------------------------+----------------------+-----+
  47. | :ref:`Texture<class_Texture>` | color_hue | |
  48. +-------------------------------+----------------------+-----+
  49. | :ref:`Texture<class_Texture>` | color_sample | |
  50. +-------------------------------+----------------------+-----+
  51. | :ref:`int<class_int>` | h_width | 30 |
  52. +-------------------------------+----------------------+-----+
  53. | :ref:`int<class_int>` | label_width | 10 |
  54. +-------------------------------+----------------------+-----+
  55. | :ref:`int<class_int>` | margin | 4 |
  56. +-------------------------------+----------------------+-----+
  57. | :ref:`Texture<class_Texture>` | overbright_indicator | |
  58. +-------------------------------+----------------------+-----+
  59. | :ref:`Texture<class_Texture>` | preset_bg | |
  60. +-------------------------------+----------------------+-----+
  61. | :ref:`Texture<class_Texture>` | screen_picker | |
  62. +-------------------------------+----------------------+-----+
  63. | :ref:`int<class_int>` | sv_height | 256 |
  64. +-------------------------------+----------------------+-----+
  65. | :ref:`int<class_int>` | sv_width | 256 |
  66. +-------------------------------+----------------------+-----+
  67. Signals
  68. -------
  69. .. _class_ColorPicker_signal_color_changed:
  70. - **color_changed** **(** :ref:`Color<class_Color>` color **)**
  71. Emitted when the color is changed.
  72. ----
  73. .. _class_ColorPicker_signal_preset_added:
  74. - **preset_added** **(** :ref:`Color<class_Color>` color **)**
  75. Emitted when a preset is added.
  76. ----
  77. .. _class_ColorPicker_signal_preset_removed:
  78. - **preset_removed** **(** :ref:`Color<class_Color>` color **)**
  79. Emitted when a preset is removed.
  80. Property Descriptions
  81. ---------------------
  82. .. _class_ColorPicker_property_color:
  83. - :ref:`Color<class_Color>` **color**
  84. +-----------+-------------------------+
  85. | *Default* | ``Color( 1, 1, 1, 1 )`` |
  86. +-----------+-------------------------+
  87. | *Setter* | set_pick_color(value) |
  88. +-----------+-------------------------+
  89. | *Getter* | get_pick_color() |
  90. +-----------+-------------------------+
  91. The currently selected color.
  92. ----
  93. .. _class_ColorPicker_property_deferred_mode:
  94. - :ref:`bool<class_bool>` **deferred_mode**
  95. +-----------+--------------------------+
  96. | *Default* | ``false`` |
  97. +-----------+--------------------------+
  98. | *Setter* | set_deferred_mode(value) |
  99. +-----------+--------------------------+
  100. | *Getter* | is_deferred_mode() |
  101. +-----------+--------------------------+
  102. 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).
  103. ----
  104. .. _class_ColorPicker_property_edit_alpha:
  105. - :ref:`bool<class_bool>` **edit_alpha**
  106. +-----------+-----------------------+
  107. | *Default* | ``true`` |
  108. +-----------+-----------------------+
  109. | *Setter* | set_edit_alpha(value) |
  110. +-----------+-----------------------+
  111. | *Getter* | is_editing_alpha() |
  112. +-----------+-----------------------+
  113. If ``true``, shows an alpha channel slider (transparency).
  114. ----
  115. .. _class_ColorPicker_property_hsv_mode:
  116. - :ref:`bool<class_bool>` **hsv_mode**
  117. +-----------+---------------------+
  118. | *Default* | ``false`` |
  119. +-----------+---------------------+
  120. | *Setter* | set_hsv_mode(value) |
  121. +-----------+---------------------+
  122. | *Getter* | is_hsv_mode() |
  123. +-----------+---------------------+
  124. If ``true``, allows editing the color with Hue/Saturation/Value sliders.
  125. **Note:** Cannot be enabled if raw mode is on.
  126. ----
  127. .. _class_ColorPicker_property_presets_enabled:
  128. - :ref:`bool<class_bool>` **presets_enabled**
  129. +-----------+----------------------------+
  130. | *Default* | ``true`` |
  131. +-----------+----------------------------+
  132. | *Setter* | set_presets_enabled(value) |
  133. +-----------+----------------------------+
  134. | *Getter* | are_presets_enabled() |
  135. +-----------+----------------------------+
  136. If ``true``, the "add preset" button is enabled.
  137. ----
  138. .. _class_ColorPicker_property_presets_visible:
  139. - :ref:`bool<class_bool>` **presets_visible**
  140. +-----------+----------------------------+
  141. | *Default* | ``true`` |
  142. +-----------+----------------------------+
  143. | *Setter* | set_presets_visible(value) |
  144. +-----------+----------------------------+
  145. | *Getter* | are_presets_visible() |
  146. +-----------+----------------------------+
  147. If ``true``, saved color presets are visible.
  148. ----
  149. .. _class_ColorPicker_property_raw_mode:
  150. - :ref:`bool<class_bool>` **raw_mode**
  151. +-----------+---------------------+
  152. | *Default* | ``false`` |
  153. +-----------+---------------------+
  154. | *Setter* | set_raw_mode(value) |
  155. +-----------+---------------------+
  156. | *Getter* | is_raw_mode() |
  157. +-----------+---------------------+
  158. If ``true``, 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).
  159. **Note:** Cannot be enabled if HSV mode is on.
  160. Method Descriptions
  161. -------------------
  162. .. _class_ColorPicker_method_add_preset:
  163. - void **add_preset** **(** :ref:`Color<class_Color>` color **)**
  164. 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.
  165. **Note:** the presets list is only for *this* color picker.
  166. ----
  167. .. _class_ColorPicker_method_erase_preset:
  168. - void **erase_preset** **(** :ref:`Color<class_Color>` color **)**
  169. Removes the given color from the list of color presets of this color picker.
  170. ----
  171. .. _class_ColorPicker_method_get_presets:
  172. - :ref:`PoolColorArray<class_PoolColorArray>` **get_presets** **(** **)** |const|
  173. Returns the list of colors in the presets of the color picker.
  174. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  175. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  176. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`