Module: Gtk::ColorChooser

Defined in:
(unknown)

Overview

Gtk::ColorChooser 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 Gtk::ColorChooserWidget, #GtkColorChooserDialog and #GtkColorButton.

Instance Method Summary collapse

Instance Method Details

#add_palette(orientation, colors_per_line, n_colors, colors) ⇒ nil

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 Gtk::ColorChooserWidget has 27 colors, organized in columns of 3 colors. The default gray palette has 9 grays in a single row.

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 and gray palettes from the color chooser.

If colors is nil, removes all previously added palettes.

Parameters:

  • orientation (Gtk::Orientation)

    %GTK_ORIENTATION_HORIZONTAL if the palette should be displayed in rows, %GTK_ORIENTATION_VERTICAL for columns

  • colors_per_line (Integer)

    the number of colors to show in each row/column

  • n_colors (Integer)

    the total number of elements in colors

  • colors (Array<Gdk::RGBA>)

    the colors of the palette, or nil

Returns:

  • (nil)

#color_activated(color) ⇒ nil

Parameters:

  • color (Gdk::RGBA)

Returns:

  • (nil)

#get_rgba(color) ⇒ nil

Gets the currently-selected color.

Parameters:

  • color (Gdk::RGBA)

    a Gdk::RGBA to fill in with the current color

Returns:

  • (nil)

#rgba=(color) ⇒ nil

Sets the color.

Parameters:

  • color (Gdk::RGBA)

    the new color

Returns:

  • (nil)

#use_alphaTrueClass

Returns whether the color chooser shows the alpha channel.

Returns:

  • (TrueClass)

    true if the color chooser uses the alpha channel, false if not

#use_alpha=(use_alpha) ⇒ nil

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

Parameters:

  • use_alpha (TrueClass)

    true if color chooser should use alpha channel, false if not

Returns:

  • (nil)