Gtk.ColorDialogButton¶
class — extends Widget, Accessible, Buildable, ConstraintTarget
Opens a color chooser dialog to select a color.
<picture> <source srcset="color-button-dark.png" media="(prefers-color-scheme: dark)"> <img alt="An example GtkColorDialogButton" src="color-button.png"> </picture>
It is suitable widget for selecting a color in a preference dialog.
CSS nodes¶
GtkColorDialogButton has a single CSS node with name colorbutton which
contains a button node. To differentiate it from a plain GtkButton,
it gets the .color style class.
Constructors¶
new¶
Creates a new GtkColorDialogButton with the
given GtkColorDialog.
You can pass NULL to this function and set a GtkColorDialog
later. The button will be insensitive until that happens.
Parameters:
dialog— theGtkColorDialogto use
Methods¶
get_dialog¶
Returns the GtkColorDialog of self.
get_rgba¶
Returns the color of the button.
This function is what should be used to obtain the color that was chosen by the user. To get informed about changes, listen to "notify::rgba".
set_dialog¶
Sets a GtkColorDialog object to use for
creating the color chooser dialog that is
presented when the user clicks the button.
Parameters:
dialog— the newGtkColorDialog
set_rgba¶
Sets the color of the button.
Parameters:
color— the new color
Properties¶
dialog¶
The GtkColorDialog that contains parameters for
the color chooser dialog.
rgba¶
The selected color.
This property can be set to give the button its initial color, and it will be updated to reflect the users choice in the color chooser dialog.
Listen to notify::rgba to get informed about changes
to the buttons color.
Signals¶
activate¶
Emitted when the color dialog button is activated.
The ::activate signal on GtkColorDialogButton is an action signal
and emitting it causes the button to pop up its dialog.