:right-sidebar: True UserStyleSheet =================================================================== .. currentmodule:: gi.repository.WebKit .. versionadded:: 2.6 .. class:: UserStyleSheet(**kwargs) :no-contents-entry: A CSS style sheet which can be injected in loaded pages. Constructors ------------ .. rst-class:: interim-class .. class:: UserStyleSheet :no-index: .. classmethod:: new(source: str, injected_frames: ~gi.repository.WebKit.UserContentInjectedFrames, level: ~gi.repository.WebKit.UserStyleLevel, allow_list: list[str] | None = None, block_list: list[str] | None = None) -> ~gi.repository.WebKit.UserStyleSheet Creates a new user style sheet. Style sheets can be applied to some URIs only by passing non-null values for ``allow_list`` or ``block_list``\. Passing a :const:`None` allow_list implies that all URIs are on the allow_list. The style sheet is applied if an URI matches the allow_list and not the block_list. URI patterns must be of the form ``[protocol]://[host]/[path]``\, where the *host* and *path* components can contain the wildcard character (``*``\) to represent zero or more other characters. .. versionadded:: 2.6 :param source: Source code of the user style sheet. :param injected_frames: A :obj:`~gi.repository.WebKit.UserContentInjectedFrames` value :param level: A :obj:`~gi.repository.WebKit.UserStyleLevel` :param allow_list: An allow_list of URI patterns or :const:`None` :param block_list: A block_list of URI patterns or :const:`None` .. classmethod:: new_for_world(source: str, injected_frames: ~gi.repository.WebKit.UserContentInjectedFrames, level: ~gi.repository.WebKit.UserStyleLevel, world_name: str, allow_list: list[str] | None = None, block_list: list[str] | None = None) -> ~gi.repository.WebKit.UserStyleSheet Creates a new user style sheet for script world. Creates a new user style sheet for script world with name ``world_name``\. See :func:`~gi.repository.WebKit.UserStyleSheet.new` for a full description. .. versionadded:: 2.22 :param source: Source code of the user style sheet. :param injected_frames: A :obj:`~gi.repository.WebKit.UserContentInjectedFrames` value :param level: A :obj:`~gi.repository.WebKit.UserStyleLevel` :param world_name: the name of a ``WebKitScriptWorld`` :param allow_list: An allow_list of URI patterns or :const:`None` :param block_list: A block_list of URI patterns or :const:`None`