Top | ![]() |
![]() |
![]() |
![]() |
HdyStyleManager * | hdy_style_manager_get_default () |
HdyStyleManager * | hdy_style_manager_get_for_display () |
GdkDisplay * | hdy_style_manager_get_display () |
HdyColorScheme | hdy_style_manager_get_color_scheme () |
void | hdy_style_manager_set_color_scheme () |
gboolean | hdy_style_manager_get_system_supports_color_schemes () |
gboolean | hdy_style_manager_get_dark () |
gboolean | hdy_style_manager_get_high_contrast () |
HdyColorScheme | color-scheme | Read / Write |
gboolean | dark | Read |
GdkDisplay * | display | Read / Write / Construct Only |
gboolean | high-contrast | Read |
gboolean | system-supports-color-schemes | Read |
HdyStyleManager 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 “color-scheme” property, and to query the current appearance, as well as whether a system-wide color scheme preference exists.
Important: “gtk-application-prefer-dark-theme” should
not be used together with HdyStyleManager
and will result in a warning.
Color schemes should be used instead.
HdyStyleManager *
hdy_style_manager_get_default (void
);
Gets the default HdyStyleManager instance.
It manages all GdkDisplay instances unless the style manager for that display has an override.
See hdy_style_manager_get_for_display()
.
Since: 1.6
HdyStyleManager *
hdy_style_manager_get_for_display (GdkDisplay *display
);
Gets the HdyStyleManager instance managing display
.
It can be used to override styles for that specific display instead of the whole application.
Most applications should use hdy_style_manager_get_default()
instead.
Since: 1.6
GdkDisplay *
hdy_style_manager_get_display (HdyStyleManager *self
);
Gets the display the style manager is associated with.
The display will be NULL
for the style manager returned by
hdy_style_manager_get_default()
.
Since: 1.6
HdyColorScheme
hdy_style_manager_get_color_scheme (HdyStyleManager *self
);
Gets the requested application color scheme.
Since: 1.6
void hdy_style_manager_set_color_scheme (HdyStyleManager *self
,HdyColorScheme color_scheme
);
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.
Since: 1.6
gboolean
hdy_style_manager_get_system_supports_color_schemes
(HdyStyleManager *self
);
Gets whether the system supports color schemes.
Since: 1.6
gboolean
hdy_style_manager_get_dark (HdyStyleManager *self
);
Gets whether the application is using dark appearance.
Since: 1.6
gboolean
hdy_style_manager_get_high_contrast (HdyStyleManager *self
);
Gets whether the application is using high contrast appearance.
Since: 1.6
Application color schemes for “color-scheme”.
Inherit the parent color-scheme. When set on the
HdyStyleManager returned by |
||
Always use light appearance. |
||
Use light appearance unless the system prefers dark colors. |
||
Use dark appearance unless the system prefers light colors. |
||
Always use dark appearance. |
Since: 1.6
“color-scheme”
property“color-scheme” HdyColorScheme
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 HDY_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 HDY_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 HDY_COLOR_SCHEME_FORCE_LIGHT
and HDY_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-GdkDisplay style manager has its color scheme set to
HDY_COLOR_SCHEME_DEFAULT
, it will inherit the color scheme from the
default style manager.
For the default style manager, HDY_COLOR_SCHEME_DEFAULT
is equivalent to
HDY_COLOR_SCHEME_FORCE_LIGHT
.
The “system-supports-color-schemes” property can be used to check if the current environment provides a color scheme dddpreference.
Owner: HdyStyleManager
Flags: Read / Write
Default value: HDY_COLOR_SCHEME_DEFAULT
Since: 1.6
“dark”
property “dark” gboolean
Whether the application is using dark appearance.
This property can be used to query the current appearance, as requested via “color-scheme”.
Owner: HdyStyleManager
Flags: Read
Default value: FALSE
Since: 1.6
“display”
property “display” GdkDisplay *
The display the style manager is associated with.
The display will be NULL
for the style manager returned by
hdy_style_manager_get_default()
.
Owner: HdyStyleManager
Flags: Read / Write / Construct Only
Since: 1.6
“high-contrast”
property “high-contrast” gboolean
Whether the application is using high contrast appearance.
This cannot be overridden by applications.
Owner: HdyStyleManager
Flags: Read
Default value: FALSE
Since: 1.6
“system-supports-color-schemes”
property “system-supports-color-schemes” gboolean
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
.
It's only set at startup and cannot change its value later.
See “color-scheme”.
Owner: HdyStyleManager
Flags: Read
Default value: FALSE
Since: 1.6