WebKitColorChooserRequest: WebKitGTK Reference Manual

## WebKitColorChooserRequest WebKitColorChooserRequest — A request to open a color chooser |

## Functions

void | webkit_color_chooser_request_get_rgba ()
void | webkit_color_chooser_request_set_rgba ()
void | webkit_color_chooser_request_get_element_rectangle ()
void | webkit_color_chooser_request_finish ()
void | webkit_color_chooser_request_cancel ()

## Properties

GdkRGBA * | rgba | Read / Write / Construct

## Signals

void | finished | Run Last

## Types and Values

struct | WebKitColorChooserRequest

## Object Hierarchy

        GObject
        ╰── WebKitColorChooserRequest

## Description

Whenever the user interacts with an <input type='color' /> HTML element, WebKit will need to show a dialog to choose a color. For that to happen in a general way, instead of just opening a GtkColorChooser (which might be not desirable in some cases, which could prefer to use their own color chooser dialog), WebKit will fire the “run-color-chooser” signal with a WebKitColorChooserRequest object, which will allow the client application to specify the color to be selected, to inspect the details of the request (e.g. to get initial color) and to cancel the request, in case nothing was selected.

In case the client application does not wish to handle this signal, WebKit will provide a default handler which will asynchronously run a regular GtkColorChooserDialog for the user to interact with.

## Functions

### webkit_color_chooser_request_get_rgba ()

    void
    webkit_color_chooser_request_get_rgba (WebKitColorChooserRequest *request,
                                           GdkRGBA *rgba);

Gets the current GdkRGBA color of `request`

#### Parameters

request | a WebKitColorChooserRequest |
rgba | a GdkRGBA to fill in with the current color. | [out]

Since: 2.8

### webkit_color_chooser_request_set_rgba ()

    void
    webkit_color_chooser_request_set_rgba (WebKitColorChooserRequest *request,
                                           const GdkRGBA *rgba);

Sets the current GdkRGBA color of `request`

#### Parameters

request | a WebKitFileChooserRequest |
rgba | a pointer GdkRGBA |

Since: 2.8

### webkit_color_chooser_request_get_element_rectangle ()

    void
    webkit_color_chooser_request_get_element_rectangle
                                   (WebKitColorChooserRequest *request,
                                    GdkRectangle *rect);

Gets the bounding box of the color input element.

#### Parameters

request | a WebKitColorChooserRequest |
rect | a GdkRectangle to fill in with the element area. | [out]

Since: 2.8

### webkit_color_chooser_request_finish ()

    void
    webkit_color_chooser_request_finish (WebKitColorChooserRequest *request);

Finishes `request` and the input element keeps the current value of “rgba”. The signal “finished” is emitted to notify that the request has finished.

#### Parameters

request | a WebKitColorChooserRequest |

Since: 2.8

### webkit_color_chooser_request_cancel ()

    void
    webkit_color_chooser_request_cancel (WebKitColorChooserRequest *request);

Cancels `request` and the input element changes to use the initial color it has before the request started. The signal “finished” is emitted to notify that the request has finished.

#### Parameters

request | a WebKitColorChooserRequest |

Since: 2.8

## Types and Values

### struct WebKitColorChooserRequest

    struct WebKitColorChooserRequest;

## Property Details

### The `“rgba”` property

      “rgba”                     GdkRGBA *

The current RGBA color for the request.

Flags: Read / Write / Construct

## Signal Details

### The `“finished”` signal

    void
    user_function (WebKitColorChooserRequest *request,
                   gpointer                   user_data)

Emitted when the `request` finishes. This signal can be emitted because the user completed the `request` calling `webkit_color_chooser_request_finish()`, or cancelled it with `webkit_color_chooser_request_cancel()` or because the color input element is removed from the DOM.

#### Parameters

request | the WebKitColorChooserRequest on which the signal is emitted |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 2.8

## See Also

WebKitWebView