## GtkColorSelection GtkColorSelection — Deprecated widget used to select a color |

## Functions

GtkWidget * | gtk_color_selection_new ()
void | gtk_color_selection_set_has_opacity_control ()
gboolean | gtk_color_selection_get_has_opacity_control ()
void | gtk_color_selection_set_has_palette ()
gboolean | gtk_color_selection_get_has_palette ()
guint16 | gtk_color_selection_get_current_alpha ()
void | gtk_color_selection_set_current_alpha ()
void | gtk_color_selection_get_current_color ()
void | gtk_color_selection_set_current_color ()
guint16 | gtk_color_selection_get_previous_alpha ()
void | gtk_color_selection_set_previous_alpha ()
void | gtk_color_selection_get_previous_color ()
void | gtk_color_selection_set_previous_color ()
void | gtk_color_selection_get_current_rgba ()
void | gtk_color_selection_set_current_rgba ()
void | gtk_color_selection_get_previous_rgba ()
void | gtk_color_selection_set_previous_rgba ()
gboolean | gtk_color_selection_is_adjusting ()
gboolean | gtk_color_selection_palette_from_string ()
gchar * | gtk_color_selection_palette_to_string ()
void | (*GtkColorSelectionChangePaletteFunc) ()
GtkColorSelectionChangePaletteWithScreenFunc | gtk_color_selection_set_change_palette_with_screen_hook ()
void | (*GtkColorSelectionChangePaletteWithScreenFunc) ()

## Properties

guint | current-alpha | Read / Write
GdkColor * | current-color | Read / Write
GdkRGBA * | current-rgba | Read / Write
gboolean | has-opacity-control | Read / Write
gboolean | has-palette | Read / Write

## Signals

void | color-changed | Run First

## Types and Values

struct | GtkColorSelection
struct | GtkColorSelectionClass

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkWidget
                ╰── GtkContainer
                    ╰── GtkBox
                        ╰── GtkColorSelection

## Implemented Interfaces

GtkColorSelection implements AtkImplementorIface, GtkBuildable and GtkOrientable.

## Includes

    #include <gtk/gtk.h>

## Description

The GtkColorSelection is a widget that is used to select a color. It consists of a color wheel and number of sliders and entry boxes for color parameters such as hue, saturation, value, red, green, blue, and opacity. It is found on the standard color selection dialog box GtkColorSelectionDialog.

## Functions

### gtk_color_selection_new ()

    GtkWidget *
    gtk_color_selection_new (void);

`gtk_color_selection_new` is deprecated and should not be used in newly-written code.

Creates a new GtkColorSelection.

#### Returns

a new GtkColorSelection

### gtk_color_selection_set_has_opacity_control ()

    void
    gtk_color_selection_set_has_opacity_control
                                   (GtkColorSelection *colorsel,
                                    gboolean has_opacity);

`gtk_color_selection_set_has_opacity_control` is deprecated and should not be used in newly-written code.

Sets the `colorsel` to use or not use opacity.

#### Parameters

colorsel | a GtkColorSelection |
has_opacity | `TRUE` if `colorsel` can set the opacity, `FALSE` otherwise |

### gtk_color_selection_get_has_opacity_control ()

    gboolean
    gtk_color_selection_get_has_opacity_control
                                   (GtkColorSelection *colorsel);

`gtk_color_selection_get_has_opacity_control` is deprecated and should not be used in newly-written code.

Determines whether the colorsel has an opacity control.

#### Parameters

colorsel | a GtkColorSelection |

#### Returns

`TRUE` if the `colorsel` has an opacity control, `FALSE` if it does't

### gtk_color_selection_set_has_palette ()

    void
    gtk_color_selection_set_has_palette (GtkColorSelection *colorsel,
                                         gboolean has_palette);

`gtk_color_selection_set_has_palette` is deprecated and should not be used in newly-written code.

Shows and hides the palette based upon the value of `has_palette` .

#### Parameters

colorsel | a GtkColorSelection |
has_palette | `TRUE` if palette is to be visible, `FALSE` otherwise |

### gtk_color_selection_get_has_palette ()

    gboolean
    gtk_color_selection_get_has_palette (GtkColorSelection *colorsel);

`gtk_color_selection_get_has_palette` is deprecated and should not be used in newly-written code.

Determines whether the color selector has a color palette.

#### Parameters

colorsel | a GtkColorSelection |

#### Returns

`TRUE` if the selector has a palette, `FALSE` if it hasn't

### gtk_color_selection_get_current_alpha ()

    guint16
    gtk_color_selection_get_current_alpha (GtkColorSelection *colorsel);

`gtk_color_selection_get_current_alpha` is deprecated and should not be used in newly-written code.

Returns the current alpha value.

#### Parameters

colorsel | a GtkColorSelection |

#### Returns

an integer between 0 and 65535

### gtk_color_selection_set_current_alpha ()

    void
    gtk_color_selection_set_current_alpha (GtkColorSelection *colorsel,
                                           guint16 alpha);

`gtk_color_selection_set_current_alpha` is deprecated and should not be used in newly-written code.

Sets the current opacity to be `alpha` .

The first time this is called, it will also set the original opacity to be `alpha` too.

#### Parameters

colorsel | a GtkColorSelection |
alpha | an integer between 0 and 65535 |

### gtk_color_selection_get_current_color ()

    void
    gtk_color_selection_get_current_color (GtkColorSelection *colorsel,
                                           GdkColor *color);

`gtk_color_selection_get_current_color` has been deprecated since version 3.4 and should not be used in newly-written code.

Use `gtk_color_selection_get_current_rgba()` instead.

Sets `color` to be the current color in the GtkColorSelection widget.

#### Parameters

colorsel | a GtkColorSelection |
color | a GdkColor to fill in with the current color. | [out]

### gtk_color_selection_set_current_color ()

    void
    gtk_color_selection_set_current_color (GtkColorSelection *colorsel,
                                           const GdkColor *color);

`gtk_color_selection_set_current_color` has been deprecated since version 3.4 and should not be used in newly-written code.

Use `gtk_color_selection_set_current_rgba()` instead.

Sets the current color to be `color` .

The first time this is called, it will also set the original color to be `color` too.

#### Parameters

colorsel | a GtkColorSelection |
color | a GdkColor to set the current color with |

### gtk_color_selection_get_previous_alpha ()

    guint16
    gtk_color_selection_get_previous_alpha
                                   (GtkColorSelection *colorsel);

`gtk_color_selection_get_previous_alpha` is deprecated and should not be used in newly-written code.

Returns the previous alpha value.

#### Parameters

colorsel | a GtkColorSelection |

#### Returns

an integer between 0 and 65535

### gtk_color_selection_set_previous_alpha ()

    void
    gtk_color_selection_set_previous_alpha
                                   (GtkColorSelection *colorsel,
                                    guint16 alpha);

`gtk_color_selection_set_previous_alpha` is deprecated and should not be used in newly-written code.

Sets the “previous” alpha to be `alpha` .

This function should be called with some hesitations, as it might seem confusing to have that alpha change.

#### Parameters

colorsel | a GtkColorSelection |
alpha | an integer between 0 and 65535 |

### gtk_color_selection_get_previous_color ()

    void
    gtk_color_selection_get_previous_color
                                   (GtkColorSelection *colorsel,
                                    GdkColor *color);

`gtk_color_selection_get_previous_color` has been deprecated since version 3.4 and should not be used in newly-written code.

Use `gtk_color_selection_get_previous_rgba()` instead.

Fills `color` in with the original color value.

#### Parameters

colorsel | a GtkColorSelection |
color | a GdkColor to fill in with the original color value. | [out]

### gtk_color_selection_set_previous_color ()

    void
    gtk_color_selection_set_previous_color
                                   (GtkColorSelection *colorsel,
                                    const GdkColor *color);

`gtk_color_selection_set_previous_color` has been deprecated since version 3.4 and should not be used in newly-written code.

Use `gtk_color_selection_set_previous_rgba()` instead.

Sets the “previous” color to be `color` .

This function should be called with some hesitations, as it might seem confusing to have that color change. Calling `gtk_color_selection_set_current_color()` will also set this color the first time it is called.

#### Parameters

colorsel | a GtkColorSelection |
color | a GdkColor to set the previous color with |

### gtk_color_selection_get_current_rgba ()

    void
    gtk_color_selection_get_current_rgba (GtkColorSelection *colorsel,
                                          GdkRGBA *rgba);

`gtk_color_selection_get_current_rgba` is deprecated and should not be used in newly-written code.

Sets `rgba` to be the current color in the GtkColorSelection widget.

#### Parameters

colorsel | a GtkColorSelection |
rgba | a GdkRGBA to fill in with the current color. | [out]

Since: 3.0

### gtk_color_selection_set_current_rgba ()

    void
    gtk_color_selection_set_current_rgba (GtkColorSelection *colorsel,
                                          const GdkRGBA *rgba);

`gtk_color_selection_set_current_rgba` is deprecated and should not be used in newly-written code.

Sets the current color to be `rgba` .

The first time this is called, it will also set the original color to be `rgba` too.

#### Parameters

colorsel | a GtkColorSelection |
rgba | A GdkRGBA to set the current color with |

Since: 3.0

### gtk_color_selection_get_previous_rgba ()

    void
    gtk_color_selection_get_previous_rgba (GtkColorSelection *colorsel,
                                           GdkRGBA *rgba);

`gtk_color_selection_get_previous_rgba` is deprecated and should not be used in newly-written code.

Fills `rgba` in with the original color value.

#### Parameters

colorsel | a GtkColorSelection |
rgba | a GdkRGBA to fill in with the original color value. | [out]

Since: 3.0

### gtk_color_selection_set_previous_rgba ()

    void
    gtk_color_selection_set_previous_rgba (GtkColorSelection *colorsel,
                                           const GdkRGBA *rgba);

`gtk_color_selection_set_previous_rgba` is deprecated and should not be used in newly-written code.

Sets the “previous” color to be `rgba` .

This function should be called with some hesitations, as it might seem confusing to have that color change. Calling `gtk_color_selection_set_current_rgba()` will also set this color the first time it is called.

#### Parameters

colorsel | a GtkColorSelection |
rgba | a GdkRGBA to set the previous color with |

Since: 3.0

### gtk_color_selection_is_adjusting ()

    gboolean
    gtk_color_selection_is_adjusting (GtkColorSelection *colorsel);

`gtk_color_selection_is_adjusting` is deprecated and should not be used in newly-written code.

Gets the current state of the `colorsel` .

#### Parameters

colorsel | a GtkColorSelection |

#### Returns

`TRUE` if the user is currently dragging a color around, and `FALSE` if the selection has stopped

### gtk_color_selection_palette_from_string ()

    gboolean
    gtk_color_selection_palette_from_string
                                   (const gchar *str,
                                    GdkColor **colors,
                                    gint *n_colors);

`gtk_color_selection_palette_from_string` is deprecated and should not be used in newly-written code.

Parses a color palette string; the string is a colon-separated list of color names readable by `gdk_color_parse()`.

#### Parameters

str | a string encoding a color palette |
colors | return location for allocated array of GdkColor. | [out][array length=n_colors]
n_colors | return location for length of array |

#### Returns

`TRUE` if a palette was successfully parsed

### gtk_color_selection_palette_to_string ()

    gchar *
    gtk_color_selection_palette_to_string (const GdkColor *colors,
                                           gint n_colors);

`gtk_color_selection_palette_to_string` is deprecated and should not be used in newly-written code.

Encodes a palette as a string, useful for persistent storage.

#### Parameters

colors | an array of colors. | [array length=n_colors]
n_colors | length of the array |

#### Returns

allocated string encoding the palette

### GtkColorSelectionChangePaletteFunc ()

    void
    (*GtkColorSelectionChangePaletteFunc) (const GdkColor *colors,
                                           gint n_colors);

`GtkColorSelectionChangePaletteFunc` has been deprecated since version 3.4 and should not be used in newly-written code.

#### Parameters

colors | Array of colors. | [array length=n_colors]
n_colors | Number of colors in the array |

### gtk_color_selection_set_change_palette_with_screen_hook ()

    GtkColorSelectionChangePaletteWithScreenFunc
    gtk_color_selection_set_change_palette_with_screen_hook
                                   (GtkColorSelectionChangePaletteWithScreenFunc func);

`gtk_color_selection_set_change_palette_with_screen_hook` is deprecated and should not be used in newly-written code.

Installs a global function to be called whenever the user tries to modify the palette in a color selection.

This function should save the new palette contents, and update the “gtk-color-palette” GtkSettings property so all GtkColorSelection widgets will be modified.

[skip]

#### Parameters

func | a function to call when the custom palette needs saving |

#### Returns

the previous change palette hook (that was replaced)

Since: 2.2

### GtkColorSelectionChangePaletteWithScreenFunc ()

    void
    (*GtkColorSelectionChangePaletteWithScreenFunc)
                                   (GdkScreen *screen,
                                    const GdkColor *colors,
                                    gint n_colors);

`GtkColorSelectionChangePaletteWithScreenFunc` has been deprecated since version 3.4 and should not be used in newly-written code.

#### Parameters

colors | Array of colors. | [array length=n_colors]
n_colors | Number of colors in the array |

Since: 2.2

## Types and Values

### struct GtkColorSelection

    struct GtkColorSelection;

### struct GtkColorSelectionClass

    struct GtkColorSelectionClass {
      GtkBoxClass parent_class;

      void (*color_changed) (GtkColorSelection *color_selection);
    };

#### Members

`color_changed` () |  |

## Property Details

### The `“current-alpha”` property

      “current-alpha”            guint

The current opacity value (0 fully transparent, 65535 fully opaque).

Owner: GtkColorSelection

Flags: Read / Write

Allowed values: <= 65535

Default value: 65535

### The `“current-color”` property

      “current-color”            GdkColor *

The current GdkColor color.

`GtkColorSelection:current-color` has been deprecated since version 3.4 and should not be used in newly-written code.

Use “current-rgba” instead.

Owner: GtkColorSelection

Flags: Read / Write

### The `“current-rgba”` property

      “current-rgba”             GdkRGBA *

The current RGBA color.

Owner: GtkColorSelection

Flags: Read / Write

Since: 3.0

### The `“has-opacity-control”` property

      “has-opacity-control”      gboolean

Whether the color selector should allow setting opacity.

Owner: GtkColorSelection

Flags: Read / Write

Default value: FALSE

### The `“has-palette”` property

      “has-palette”              gboolean

Whether a palette should be used.

Owner: GtkColorSelection

Flags: Read / Write

Default value: FALSE

## Signal Details

### The `“color-changed”` signal

    void
    user_function (GtkColorSelection *colorselection,
                   gpointer           user_data)

This signal is emitted when the color changes in the GtkColorSelection according to its update policy.

#### Parameters

colorselection | the object which received the signal. |
user_data | user data set when the signal handler was connected. |

Flags: Run First