GtkColorButton: GTK+ 4 Reference Manual

## GtkColorButton GtkColorButton — A button to launch a color selection dialog |

## Functions

GtkWidget * | gtk_color_button_new ()
GtkWidget * | gtk_color_button_new_with_rgba ()
void | gtk_color_button_set_title ()
const gchar * | gtk_color_button_get_title ()

## Types and Values

struct | GtkColorButton

## Includes

    #include <gtk/gtk.h>

## Description

The GtkColorButton is a button which displays the currently selected color and allows to open a color selection dialog to change the color. It is suitable widget for selecting a color in a preference dialog.

### CSS nodes

GtkColorButton has a single CSS node with name button. To differentiate it from a plain GtkButton, it gets the .color style class.

## Functions

### gtk_color_button_new ()

    GtkWidget *
    gtk_color_button_new (void);

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-selection dialog will open, allowing the user to select a color. The swatch will be updated to reflect the new color when the user finishes.

#### Returns

a new color button

Since: 2.4

### gtk_color_button_new_with_rgba ()

    GtkWidget *
    gtk_color_button_new_with_rgba (const GdkRGBA *rgba);

Creates a new color button.

#### Parameters

rgba | A GdkRGBA to set the current color with |

#### Returns

a new color button

Since: 3.0

### gtk_color_button_set_title ()

    void
    gtk_color_button_set_title (GtkColorButton *button,
                                const gchar *title);

Sets the title for the color selection dialog.

#### Parameters

button | a GtkColorButton |
title | String containing new window title |

Since: 2.4

### gtk_color_button_get_title ()

    const gchar *
    gtk_color_button_get_title (GtkColorButton *button);

Gets the title of the color selection dialog.

#### Parameters

button | a GtkColorButton |

#### Returns

An internal string, do not free the return value

Since: 2.4

## Types and Values

### struct GtkColorButton

    struct GtkColorButton {
      GtkWidget parent_instance;
    };

## See Also

GtkFontButton