Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

ColorPickerButton

繼承: Button < BaseButton < Control < CanvasItem < Node < Object

點擊後會顯示 ColorPicker 的按鈕。

說明

封裝一個 ColorPicker,按下按鈕即可存取該控制項。按下按鈕會切換 ColorPicker 的可見性。

另見 BaseButton,其中包含與該節點關聯的通用屬性和方法。

注意:預設情況下,按鈕的寬度可能不足以使顏色預覽色板可見。確保將 Control.custom_minimum_size 設定為足夠大的值,以便為按鈕提供足夠的空間。

教學

屬性

Color

color

Color(0, 0, 0, 1)

bool

edit_alpha

true

bool

edit_intensity

true

bool

toggle_mode

true (overrides BaseButton)

方法

ColorPicker

get_picker()

PopupPanel

get_popup()

主題屬性

Texture2D

bg


訊號

color_changed(color: Color) 🔗

顏色改變時發出。


picker_created() 🔗

建立 ColorPicker 時(第一次按下按鈕)發出。


popup_closed() 🔗

ColorPicker 關閉時發出。


屬性說明

Color color = Color(0, 0, 0, 1) 🔗

  • void set_pick_color(value: Color)

  • Color get_pick_color()

目前選擇的顏色。


bool edit_alpha = true 🔗

  • void set_edit_alpha(value: bool)

  • bool is_editing_alpha()

如果為 true,則顯示的 ColorPicker 中的 Alpha 通道將可見。


bool edit_intensity = true 🔗

  • void set_edit_intensity(value: bool)

  • bool is_editing_intensity()

If true, the intensity slider in the displayed ColorPicker will be visible.


方法說明

ColorPicker get_picker() 🔗

返回此節點所切換的 ColorPicker

警告:這是一個必需的內部節點,移除和釋放它可能會導致當機。如果你希望隱藏它或其所有子項,請使用其 CanvasItem.visible 屬性。


PopupPanel get_popup() 🔗

返回該控制項的 PopupPanel,它允許連接到其彈出訊號。這允許在顯示或隱藏 ColorPicker 時處理事件。

警告:這是一個必需的內部節點,移除和釋放它可能會導致當機。如果希望隱藏它或它的任何子項,請使用它們的 Window.visible 屬性。


主題屬性說明

Texture2D bg 🔗

顏色預覽的背景將在按鈕上顯示。