Gtk.ColorChooser

g GObject.GInterface GObject.GInterface Gtk.ColorChooser Gtk.ColorChooser GObject.GInterface->Gtk.ColorChooser

Implementations:

Gtk.ColorButton, Gtk.ColorChooserDialog, Gtk.ColorChooserWidget

Methods

add_palette (orientation, colors_per_line, colors)

get_rgba ()

get_use_alpha ()

set_rgba (color)

set_use_alpha (use_alpha)

Virtual Methods

do_add_palette (orientation, colors_per_line, colors)

do_color_activated (color)

do_get_rgba ()

do_set_rgba (color)

Properties

Name

Type

Flags

Short Description

rgba

Gdk.RGBA

r/w

deprecated

use-alpha

bool

r/w/en

deprecated

Signals

Name

Short Description

color-activated

Emitted when a color is activated from the color chooser. deprecated

Fields

None

Class Details

class Gtk.ColorChooser
Bases:

GObject.GInterface

Structure:

Gtk.ColorChooserInterface

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 [class`Gtk`.ColorChooserWidget], [class`Gtk`.ColorChooserDialog] and [class`Gtk`.ColorButton].

Deprecated since version 4.10: Use [class`Gtk`.ColorDialog] and [class`Gtk`.ColorDialogButton] instead of widgets implementing GtkColorChooser

add_palette(orientation, colors_per_line, colors)[source]
Parameters:

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 False, the colors are grouped in columns instead.

The default color palette of [class`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 None, removes all previously added palettes.

Deprecated since version 4.10: Use [class`Gtk`.ColorDialog] instead

get_rgba()[source]
Returns:

a GdkRGBA to fill in with the current color

Return type:

color: Gdk.RGBA

Gets the currently-selected color.

Deprecated since version 4.10: Use [class`Gtk`.ColorDialog] instead

get_use_alpha()[source]
Returns:

True if the color chooser uses the alpha channel, False if not

Return type:

bool

Returns whether the color chooser shows the alpha channel.

Deprecated since version 4.10: Use [class`Gtk`.ColorDialog] instead

set_rgba(color)[source]
Parameters:

color (Gdk.RGBA) – the new color

Sets the color.

Deprecated since version 4.10: Use [class`Gtk`.ColorDialog] instead

set_use_alpha(use_alpha)[source]
Parameters:

use_alpha (bool) – True if color chooser should use alpha channel, False if not

Sets whether or not the color chooser should use the alpha channel.

Deprecated since version 4.10: Use [class`Gtk`.ColorDialog] instead

do_add_palette(orientation, colors_per_line, colors) virtual
Parameters:

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 False, the colors are grouped in columns instead.

The default color palette of [class`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 None, removes all previously added palettes.

Deprecated since version 4.10: Use [class`Gtk`.ColorDialog] instead

do_color_activated(color) virtual
Parameters:

color (Gdk.RGBA) –

do_get_rgba() virtual
Returns:

a GdkRGBA to fill in with the current color

Return type:

color: Gdk.RGBA

Gets the currently-selected color.

Deprecated since version 4.10: Use [class`Gtk`.ColorDialog] instead

do_set_rgba(color) virtual
Parameters:

color (Gdk.RGBA) – the new color

Sets the color.

Deprecated since version 4.10: Use [class`Gtk`.ColorDialog] instead

Signal Details

Gtk.ColorChooser.signals.color_activated(color_chooser, color)
Signal Name:

color-activated

Flags:

RUN_FIRST

Parameters:

Emitted when a color is activated from the color chooser.

This usually happens when the user clicks a color swatch, or a color is selected and the user presses one of the keys Space, Shift+Space, Return or Enter.

Deprecated since version 4.10: Use [class`Gtk`.ColorDialog] and [class`Gtk`.ColorDialogButton] instead of widgets implementing GtkColorChooser

Property Details

Gtk.ColorChooser.props.rgba
Name:

rgba

Type:

Gdk.RGBA

Default Value:

None

Flags:

READABLE, WRITABLE

The currently selected color, as a GdkRGBA struct.

The property can be set to change the current selection programmatically.

Deprecated since version 4.10: Use [class`Gtk`.ColorDialog] and [class`Gtk`.ColorDialogButton] instead of widgets implementing GtkColorChooser

Gtk.ColorChooser.props.use_alpha
Name:

use-alpha

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether colors may have alpha (translucency).

When ::use-alpha is False, the GdkRGBA struct obtained via the [property`Gtk`.ColorChooser:rgba] property will be forced to have alpha == 1.

Implementations are expected to show alpha by rendering the color over a non-uniform background (like a checkerboard pattern).

Deprecated since version 4.10: Use [class`Gtk`.ColorDialog] and [class`Gtk`.ColorDialogButton] instead of widgets implementing GtkColorChooser