ColorPickerButton¶
Inherits: Button < BaseButton < Control < CanvasItem < Node < Object
A button that brings up a ColorPicker when pressed.
Description¶
Encapsulates a ColorPicker, making it accessible by pressing a button. Pressing the button will toggle the ColorPicker's visibility.
See also BaseButton which contains common properties and methods associated with this node.
Note: By default, the button may not be wide enough for the color preview swatch to be visible. Make sure to set Control.custom_minimum_size to a big enough value to give the button enough space.
Tutorials¶
Properties¶
|
||
|
||
toggle_mode |
|
Methods¶
get_picker ( ) |
|
get_popup ( ) |
Theme Properties¶
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
Signals¶
color_changed ( Color color )
Emitted when the color changes.
picker_created ( )
Emitted when the ColorPicker is created (the button is pressed for the first time).
popup_closed ( )
Emitted when the ColorPicker is closed.
Property Descriptions¶
Color color = Color(0, 0, 0, 1)
The currently selected color.
bool edit_alpha = true
If true
, the alpha channel in the displayed ColorPicker will be visible.
Method Descriptions¶
ColorPicker get_picker ( )
Returns the ColorPicker that this node toggles.
Warning: This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their CanvasItem.visible property.
PopupPanel get_popup ( )
Returns the control's PopupPanel which allows you to connect to popup signals. This allows you to handle events when the ColorPicker is shown or hidden.
Warning: This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their Window.visible property.
Theme Property Descriptions¶
Color font_color = Color(1, 1, 1, 1)
Default text Color of the ColorPickerButton.
Color font_disabled_color = Color(0.9, 0.9, 0.9, 0.3)
Text Color used when the ColorPickerButton is disabled.
Color font_focus_color = Color(1, 1, 1, 1)
Text Color used when the ColorPickerButton is focused. Only replaces the normal text color of the button. Disabled, hovered, and pressed states take precedence over this color.
Color font_hover_color = Color(1, 1, 1, 1)
Text Color used when the ColorPickerButton is being hovered.
Color font_outline_color = Color(1, 1, 1, 1)
The tint of text outline of the ColorPickerButton.
Color font_pressed_color = Color(0.8, 0.8, 0.8, 1)
Text Color used when the ColorPickerButton is being pressed.
int h_separation = 4
The horizontal space between ColorPickerButton's icon and text.
int outline_size = 0
The size of the text outline.
Note: If using a font with FontFile.multichannel_signed_distance_field enabled, its FontFile.msdf_pixel_range must be set to at least twice the value of outline_size for outline rendering to look correct. Otherwise, the outline may appear to be cut off earlier than intended.
Font font
Font of the ColorPickerButton's text.
int font_size
Font size of the ColorPickerButton's text.
Texture2D bg
The background of the color preview rect on the button.
StyleBox disabled
StyleBox used when the ColorPickerButton is disabled.
StyleBox focus
StyleBox used when the ColorPickerButton is focused. The focus
StyleBox is displayed over the base StyleBox, so a partially transparent StyleBox should be used to ensure the base StyleBox remains visible. A StyleBox that represents an outline or an underline works well for this purpose. To disable the focus visual effect, assign a StyleBoxEmpty resource. Note that disabling the focus visual effect will harm keyboard/controller navigation usability, so this is not recommended for accessibility reasons.
StyleBox hover
StyleBox used when the ColorPickerButton is being hovered.
StyleBox normal
Default StyleBox for the ColorPickerButton.
StyleBox pressed
StyleBox used when the ColorPickerButton is being pressed.