:right-sidebar: True ColorButton =================================================================== .. currentmodule:: gi.repository.Gtk .. deprecated:: 4.10 Use :obj:`~gi.repository.Gtk.ColorDialogButton` instead .. class:: ColorButton(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gtk.Widget`, :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.Gtk.Accessible`, :class:`~gi.repository.Gtk.Buildable`, :class:`~gi.repository.Gtk.ColorChooser`, :class:`~gi.repository.Gtk.ConstraintTarget` The ``GtkColorButton`` allows to open a color chooser dialog to change the color. .. image:: https://docs.gtk.org/gtk4/color-button.png It is suitable widget for selecting a color in a preference dialog. CSS nodes -------------------------------------------------------------------------------- .. code-block:: :dedent: colorbutton ╰── button.color ╰── [content] ``GtkColorButton`` 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 ------------ .. rst-class:: interim-class .. class:: ColorButton :no-index: .. classmethod:: new() -> ~gi.repository.Gtk.Widget Creates a new color button. This returns a widget in the form of a small button containing a swatch representing the current selected color. When the button is clicked, a color chooser dialog will open, allowing the user to select a color. The swatch will be updated to reflect the new color when the user finishes. .. deprecated:: 4.10 Use :obj:`~gi.repository.Gtk.ColorDialogButton` instead .. classmethod:: new_with_rgba(rgba: ~gi.repository.Gdk.RGBA) -> ~gi.repository.Gtk.Widget Creates a new color button showing the given color. :param rgba: A ``GdkRGBA`` to set the current color with Methods ------- .. rst-class:: interim-class .. class:: ColorButton :no-index: .. method:: get_modal() -> bool Gets whether the dialog is modal. .. deprecated:: 4.10 Use :obj:`~gi.repository.Gtk.ColorDialogButton` instead .. method:: get_title() -> str Gets the title of the color chooser dialog. .. deprecated:: 4.10 Use :obj:`~gi.repository.Gtk.ColorDialogButton` instead .. method:: set_modal(modal: bool) -> None Sets whether the dialog should be modal. .. deprecated:: 4.10 Use :obj:`~gi.repository.Gtk.ColorDialogButton` instead :param modal: :const:`True` to make the dialog modal .. method:: set_title(title: str) -> None Sets the title for the color chooser dialog. .. deprecated:: 4.10 Use :obj:`~gi.repository.Gtk.ColorDialogButton` instead :param title: String containing new window title Properties ---------- .. rst-class:: interim-class .. class:: ColorButton :no-index: .. attribute:: props.modal :type: bool The type of the None singleton. .. attribute:: props.show_editor :type: bool The type of the None singleton. .. attribute:: props.title :type: str The type of the None singleton. Signals ------- .. rst-class:: interim-class .. class:: ColorButton.signals :no-index: .. method:: activate() -> None Emitted to when the color button is activated. The ``::activate`` signal on ``GtkMenuButton`` is an action signal and emitting it causes the button to pop up its dialog. .. versionadded:: 4.4 .. method:: color_set() -> None The type of the None singleton.