:right-sidebar: True ColorChooser =================================================================== .. currentmodule:: gi.repository.Gtk .. deprecated:: 4.10 Use :obj:`~gi.repository.Gtk.ColorDialog` and :obj:`~gi.repository.Gtk.ColorDialogButton` instead of widgets implementing ``GtkColorChooser`` .. class:: ColorChooser(*args, **kwargs) :no-contents-entry: Implementations: :class:`~gi.repository.Gtk.ColorButton`, :class:`~gi.repository.Gtk.ColorChooserDialog`, :class:`~gi.repository.Gtk.ColorChooserWidget` ``GtkColorChooser`` is an interface that is implemented by widgets for choosing colors. Depending on the situation, colors may be allowed to have alpha (translucency). In GTK, the main widgets that implement this interface are :obj:`~gi.repository.Gtk.ColorChooserWidget`\, :obj:`~gi.repository.Gtk.ColorChooserDialog` and :obj:`~gi.repository.Gtk.ColorButton`\. Methods ------- .. rst-class:: interim-class .. class:: ColorChooser :no-index: .. method:: add_palette(orientation: ~gi.repository.Gtk.Orientation, colors_per_line: int, colors: list[~gi.repository.Gdk.RGBA] | None = None) -> None Adds a palette to the color chooser. If ``orientation`` is horizontal, the colors are grouped in rows, with ``colors_per_line`` colors in each row. If ``horizontal`` is :const:`False`, the colors are grouped in columns instead. The default color palette of :obj:`~gi.repository.Gtk.ColorChooserWidget` has 45 colors, organized in columns of 5 colors (this includes some grays). The layout of the color chooser widget works best when the palettes have 9-10 columns. Calling this function for the first time has the side effect of removing the default color palette from the color chooser. If ``colors`` is :const:`None`, removes all previously added palettes. .. deprecated:: 4.10 Use :obj:`~gi.repository.Gtk.ColorDialog` instead :param orientation: :const:`~gi.repository.Gtk.Orientation.HORIZONTAL` if the palette should be displayed in rows, :const:`~gi.repository.Gtk.Orientation.VERTICAL` for columns :param colors_per_line: the number of colors to show in each row/column :param colors: the colors of the palette .. method:: get_rgba() -> ~gi.repository.Gdk.RGBA Gets the currently-selected color. .. deprecated:: 4.10 Use :obj:`~gi.repository.Gtk.ColorDialog` instead .. method:: get_use_alpha() -> bool Returns whether the color chooser shows the alpha channel. .. deprecated:: 4.10 Use :obj:`~gi.repository.Gtk.ColorDialog` instead .. method:: set_rgba(color: ~gi.repository.Gdk.RGBA) -> None Sets the color. .. deprecated:: 4.10 Use :obj:`~gi.repository.Gtk.ColorDialog` instead :param color: the new color .. method:: set_use_alpha(use_alpha: bool) -> None Sets whether or not the color chooser should use the alpha channel. .. deprecated:: 4.10 Use :obj:`~gi.repository.Gtk.ColorDialog` instead :param use_alpha: :const:`True` if color chooser should use alpha channel, :const:`False` if not Properties ---------- .. rst-class:: interim-class .. class:: ColorChooser :no-index: .. attribute:: props.rgba :type: ~gi.repository.Gdk.RGBA The type of the None singleton. .. deprecated:: 4.10 Use :obj:`~gi.repository.Gtk.ColorDialog` and :obj:`~gi.repository.Gtk.ColorDialogButton` instead of widgets implementing ``GtkColorChooser`` .. attribute:: props.use_alpha :type: bool The type of the None singleton. .. deprecated:: 4.10 Use :obj:`~gi.repository.Gtk.ColorDialog` and :obj:`~gi.repository.Gtk.ColorDialogButton` instead of widgets implementing ``GtkColorChooser`` Signals ------- .. rst-class:: interim-class .. class:: ColorChooser.signals :no-index: .. method:: color_activated(color: ~gi.repository.Gdk.RGBA) -> None The type of the None singleton. .. deprecated:: 4.10 Use :obj:`~gi.repository.Gtk.ColorDialog` and :obj:`~gi.repository.Gtk.ColorDialogButton` instead of widgets implementing ``GtkColorChooser`` :param color: the color Virtual Methods --------------- .. rst-class:: interim-class .. class:: ColorChooser :no-index: .. method:: do_add_palette(orientation: ~gi.repository.Gtk.Orientation, colors_per_line: int, colors: list[~gi.repository.Gdk.RGBA] | None = None) -> None Adds a palette to the color chooser. If ``orientation`` is horizontal, the colors are grouped in rows, with ``colors_per_line`` colors in each row. If ``horizontal`` is :const:`False`, the colors are grouped in columns instead. The default color palette of :obj:`~gi.repository.Gtk.ColorChooserWidget` has 45 colors, organized in columns of 5 colors (this includes some grays). The layout of the color chooser widget works best when the palettes have 9-10 columns. Calling this function for the first time has the side effect of removing the default color palette from the color chooser. If ``colors`` is :const:`None`, removes all previously added palettes. .. deprecated:: 4.10 Use :obj:`~gi.repository.Gtk.ColorDialog` instead :param orientation: :const:`~gi.repository.Gtk.Orientation.HORIZONTAL` if the palette should be displayed in rows, :const:`~gi.repository.Gtk.Orientation.VERTICAL` for columns :param colors_per_line: the number of colors to show in each row/column :param colors: the colors of the palette .. method:: do_color_activated(color: ~gi.repository.Gdk.RGBA) -> None The type of the None singleton. :param color: .. method:: do_get_rgba() -> ~gi.repository.Gdk.RGBA Gets the currently-selected color. .. deprecated:: 4.10 Use :obj:`~gi.repository.Gtk.ColorDialog` instead .. method:: do_set_rgba(color: ~gi.repository.Gdk.RGBA) -> None Sets the color. .. deprecated:: 4.10 Use :obj:`~gi.repository.Gtk.ColorDialog` instead :param color: the new color