class_colorpicker.rst 9.9 KB

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