:right-sidebar: True StyleManager =================================================================== .. currentmodule:: gi.repository.Adw .. class:: StyleManager(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` A class for managing application-wide styling. ``AdwStyleManager`` provides a way to query and influence the application styles, such as whether to use dark or high contrast appearance. It allows to set the color scheme via the :obj:`~gi.repository.Adw.StyleManager.props.color_scheme` property, and to query the current appearance, as well as whether a system-wide color scheme preference exists. Methods ------- .. rst-class:: interim-class .. class:: StyleManager :no-index: .. method:: get_color_scheme() -> ~gi.repository.Adw.ColorScheme Gets the requested application color scheme. .. method:: get_dark() -> bool Gets whether the application is using dark appearance. This can be used to query the current appearance, as requested via :obj:`~gi.repository.Adw.StyleManager.props.color_scheme`. .. method:: get_default() -> ~gi.repository.Adw.StyleManager Gets the default ``AdwStyleManager`` instance. It manages all :obj:`~gi.repository.Gdk.Display` instances unless the style manager for that display has an override. See :obj:`~gi.repository.StyleManager.get_for_display`. .. method:: get_display() -> ~gi.repository.Gdk.Display | None Gets the display the style manager is associated with. The display will be ``NULL`` for the style manager returned by :obj:`~gi.repository.StyleManager.get_default`. .. method:: get_for_display(display: ~gi.repository.Gdk.Display) -> ~gi.repository.Adw.StyleManager Gets the ``AdwStyleManager`` instance managing ``display``. It can be used to override styles for that specific display instead of the whole application. Most applications should use :obj:`~gi.repository.StyleManager.get_default` instead. :param display: a ``GdkDisplay`` .. method:: get_high_contrast() -> bool Gets whether the application is using high contrast appearance. This cannot be overridden by applications. .. method:: get_system_supports_color_schemes() -> bool Gets whether the system supports color schemes. This can be used to check if the current environment provides a color scheme preference. For example, applications might want to show a separate appearance switcher if it's set to ``FALSE``. .. method:: set_color_scheme(color_scheme: ~gi.repository.Adw.ColorScheme) -> None Sets the requested application color scheme. The effective appearance will be decided based on the application color scheme and the system preferred color scheme. The :obj:`~gi.repository.Adw.StyleManager.props.dark` property can be used to query the current effective appearance. The ``ADW_COLOR_SCHEME_PREFER_LIGHT`` color scheme results in the application using light appearance unless the system prefers dark colors. This is the default value. The ``ADW_COLOR_SCHEME_PREFER_DARK`` color scheme results in the application using dark appearance, but can still switch to the light appearance if the system can prefers it, for example, when the high contrast preference is enabled. The ``ADW_COLOR_SCHEME_FORCE_LIGHT`` and ``ADW_COLOR_SCHEME_FORCE_DARK`` values ignore the system preference entirely. They are useful if the application wants to match its UI to its content or to provide a separate color scheme switcher. If a per-:obj:`~gi.repository.Gdk.Display` style manager has its color scheme set to ``ADW_COLOR_SCHEME_DEFAULT``, it will inherit the color scheme from the default style manager. For the default style manager, ``ADW_COLOR_SCHEME_DEFAULT`` is equivalent to ``ADW_COLOR_SCHEME_PREFER_LIGHT``. The :obj:`~gi.repository.Adw.StyleManager.props.system_supports_color_schemes` property can be used to check if the current environment provides a color scheme preference. :param color_scheme: the color scheme Properties ---------- .. rst-class:: interim-class .. class:: StyleManager :no-index: .. attribute:: props.color_scheme :type: ~gi.repository.Adw.ColorScheme The requested application color scheme. The effective appearance will be decided based on the application color scheme and the system preferred color scheme. The :obj:`~gi.repository.Adw.StyleManager.props.dark` property can be used to query the current effective appearance. The ``ADW_COLOR_SCHEME_PREFER_LIGHT`` color scheme results in the application using light appearance unless the system prefers dark colors. This is the default value. The ``ADW_COLOR_SCHEME_PREFER_DARK`` color scheme results in the application using dark appearance, but can still switch to the light appearance if the system can prefers it, for example, when the high contrast preference is enabled. The ``ADW_COLOR_SCHEME_FORCE_LIGHT`` and ``ADW_COLOR_SCHEME_FORCE_DARK`` values ignore the system preference entirely. They are useful if the application wants to match its UI to its content or to provide a separate color scheme switcher. If a per-:obj:`~gi.repository.Gdk.Display` style manager has its color scheme set to ``ADW_COLOR_SCHEME_DEFAULT``, it will inherit the color scheme from the default style manager. For the default style manager, ``ADW_COLOR_SCHEME_DEFAULT`` is equivalent to ``ADW_COLOR_SCHEME_PREFER_LIGHT``. The :obj:`~gi.repository.Adw.StyleManager.props.system_supports_color_schemes` property can be used to check if the current environment provides a color scheme preference. .. attribute:: props.dark :type: bool Whether the application is using dark appearance. This property can be used to query the current appearance, as requested via :obj:`~gi.repository.Adw.StyleManager.props.color_scheme`. .. attribute:: props.display :type: ~gi.repository.Gdk.Display The display the style manager is associated with. The display will be ``NULL`` for the style manager returned by :obj:`~gi.repository.StyleManager.get_default`. .. attribute:: props.high_contrast :type: bool Whether the application is using high contrast appearance. This cannot be overridden by applications. .. attribute:: props.system_supports_color_schemes :type: bool Whether the system supports color schemes. This property can be used to check if the current environment provides a color scheme preference. For example, applications might want to show a separate appearance switcher if it's set to ``FALSE``. See :obj:`~gi.repository.Adw.StyleManager.props.color_scheme`.