StyleManager#
Superclasses: 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 style, the system accent color or high
contrast appearance.
It allows to set the color scheme via the
color_scheme
property, and to query the current
appearance, as well as whether a system-wide color scheme and accent color
preferences exists.
Methods#
- class StyleManager
- get_accent_color() AccentColor #
Gets the current system accent color.
See also
accent_color_rgba
.Added in version 1.6.
- get_accent_color_rgba() RGBA #
Gets the current system accent color as a
GdkRGBA
.Equivalent to calling
to_rgba
on the value ofaccent_color
.This is a background color. The matching foreground color is white.
Added in version 1.6.
- get_color_scheme() ColorScheme #
Gets the requested application color scheme.
- get_dark() bool #
Gets whether the application is using dark appearance.
This can be used to query the current appearance, as requested via
color_scheme
.
- get_default() StyleManager #
Gets the default
AdwStyleManager
instance.It manages all
Display
instances unless the style manager for that display has an override.See
get_for_display
.
- get_display() Display | None #
Gets the display the style manager is associated with.
The display will be
NULL
for the style manager returned byget_default
.
- get_for_display(display: Display) StyleManager #
Gets the
AdwStyleManager
instance managingdisplay
.It can be used to override styles for that specific display instead of the whole application.
Most applications should use
get_default
instead.- Parameters:
display – a
GdkDisplay
- get_high_contrast() bool #
Gets whether the application is using high contrast appearance.
This cannot be overridden by applications.
- get_system_supports_accent_colors() bool #
Gets whether the system supports accent colors.
This can be used to check if the current environment provides an accent color preference. For example, applications might want to show a preference for choosing accent color if it’s set to
FALSE
.See
accent_color
.Added in version 1.6.
- 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
.
- set_color_scheme(color_scheme: 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
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
andADW_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-
Display
style manager has its color scheme set toADW_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 toADW_COLOR_SCHEME_PREFER_LIGHT
.The
system_supports_color_schemes
property can be used to check if the current environment provides a color scheme preference.- Parameters:
color_scheme – the color scheme
Properties#
- class StyleManager
- props.accent_color: AccentColor#
The type of the None singleton.
Added in version 1.6.
- props.color_scheme: ColorScheme#
The type of the None singleton.