:right-sidebar: True ColorChooserRequest =================================================================== .. currentmodule:: gi.repository.WebKit .. class:: ColorChooserRequest(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` A request to open a color chooser. Whenever the user interacts with an 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 :obj:`~gi.repository.Gtk.ColorChooser` (which might be not desirable in some cases, which could prefer to use their own color chooser dialog), WebKit will fire the :obj:`~gi.repository.WebKit.WebView`\::run-color-chooser signal with a :obj:`~gi.repository.WebKit.ColorChooserRequest` 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. Methods ------- .. rst-class:: interim-class .. class:: ColorChooserRequest :no-index: .. method:: cancel() -> None Cancels ``request`` and the input element changes to use the initial color. Cancels ``request`` and the input element changes to use the initial color it has before the request started. The signal :obj:`~gi.repository.WebKit.ColorChooserRequest`\::finished is emitted to notify that the request has finished. .. versionadded:: 2.8 .. method:: finish() -> None Finishes ``request`` and the input element keeps the current value of :obj:`~gi.repository.WebKit.ColorChooserRequest`\:rgba. Finishes ``request`` and the input element keeps the current value of :obj:`~gi.repository.WebKit.ColorChooserRequest`\:rgba. The signal :obj:`~gi.repository.WebKit.ColorChooserRequest`\::finished is emitted to notify that the request has finished. .. versionadded:: 2.8 .. method:: get_element_rectangle() -> ~gi.repository.Gdk.Rectangle Gets the bounding box of the color input element. .. versionadded:: 2.8 .. method:: get_rgba() -> ~gi.repository.Gdk.RGBA Gets the current :obj:`~gi.repository.Gdk.RGBA` color of ``request`` .. versionadded:: 2.8 .. method:: set_rgba(rgba: ~gi.repository.Gdk.RGBA) -> None Sets the current :obj:`~gi.repository.Gdk.RGBA` color of ``request`` .. versionadded:: 2.8 :param rgba: a pointer :obj:`~gi.repository.Gdk.RGBA` Properties ---------- .. rst-class:: interim-class .. class:: ColorChooserRequest :no-index: .. attribute:: props.rgba :type: ~gi.repository.Gdk.RGBA The :obj:`~gi.repository.Gdk.RGBA` color of the request .. versionadded:: 2.8 Signals ------- .. rst-class:: interim-class .. class:: ColorChooserRequest.signals :no-index: .. method:: finished() -> None Emitted when the ``request`` finishes. This signal can be emitted because the user completed the ``request`` calling :func:`~gi.repository.WebKit.ColorChooserRequest.finish`, or cancelled it with :func:`~gi.repository.WebKit.ColorChooserRequest.cancel` or because the color input element is removed from the DOM. .. versionadded:: 2.8