1.58 <AdwStyleManager>

Class: <AdwStyleManager>

It derives from <GObject>.

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 StyleManager:color-scheme property, and to query the current appearance, as well as whether a system-wide color scheme and accent color preferences exists.

Properties

Property: style-manager:accent-color self

The current system accent color.

See also StyleManager:accent-color-rgba.

Its value is a <AdwAccentColor>.

It is read only.

Property: style-manager:accent-color-rgba self

The current system accent color as a <GdkRGBA>.

Equivalent to calling AccentColor.to_rgba on the value of StyleManager:accent-color.

This is a background color. The matching foreground color is white.

Its value is a <GdkRGBA>, or #f.

It is read only.

Property: style-manager:color-scheme self

The requested application color scheme.

The effective appearance will be decided based on the application color scheme and the system preferred color scheme. The StyleManager:dark property can be used to query the current effective appearance.

The Adw.ColorScheme.prefer-light color scheme results in the application using light appearance unless the system prefers dark colors. This is the default value.

The Adw.ColorScheme.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.ColorScheme.force-light and Adw.ColorScheme.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 Adw.ColorScheme.default, it will inherit the color scheme from the default style manager.

For the default style manager, Adw.ColorScheme.default is equivalent to Adw.ColorScheme.prefer-light.

The StyleManager:system-supports-color-schemes property can be used to check if the current environment provides a color scheme preference.

Its value is a <AdwColorScheme> (or, to set it, one of its symbols).

Set it with (set! (style-manager:color-scheme self) value).

Property: style-manager:dark self

Whether the application is using dark appearance.

This property can be used to query the current appearance, as requested via StyleManager:color-scheme.

Its value is a boolean.

It is read only.

Property: style-manager:display self

The display the style manager is associated with.

The display will be NULL for the style manager returned by StyleManager.get_default.

Its value is a <GdkDisplay>, or #f.

It can only be set when the object is made, with #:display.

Property: style-manager:document-font-name self

The system document font.

The font is in the same format as settings:gtk-font-name, e.g. "Adwaita Sans 12".

Use font-description:from-string to parse it.

Its value is a string, or #f.

It is read only.

Property: style-manager:high-contrast self

Whether the application is using high contrast appearance.

This cannot be overridden by applications.

Its value is a boolean.

It is read only.

Property: style-manager:monospace-font-name self

The system monospace font.

The font is in the same format as settings:gtk-font-name, e.g. "Adwaita Mono 11".

Use font-description:from-string to parse it.

Its value is a string, or #f.

It is read only.

Property: style-manager:system-supports-accent-colors self

Whether the system supports accent colors.

This property 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 StyleManager:accent-color.

Its value is a boolean.

It is read only.

Property: style-manager:system-supports-color-schemes self

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 StyleManager:color-scheme.

Its value is a boolean.

It is read only.

Property: style-manager:yaru-accent self

The Yaru accent color used by the application, if any. This is only available in ubuntu.

This cannot be overridden by applications.

Its value is a string, or #f.

It is read only.

Procedures

Method: style-manager:get-accent-color self ⇒ %return
Method: get-accent-color self ⇒ %return

Gets the current system accent color.

See also StyleManager:accent-color-rgba.

self

Passed: a <AdwStyleManager>.

a style manager

%return

Returned: a <AdwAccentColor>.

the current system accent color

Method: style-manager:get-accent-color-rgba self ⇒ %return
Method: get-accent-color-rgba self ⇒ %return

Gets the current system accent color as a <GdkRGBA>.

Equivalent to calling AccentColor.to_rgba on the value of StyleManager:accent-color.

This is a background color. The matching foreground color is white.

self

Passed: a <AdwStyleManager>.

a style manager

%return

Returned: a <GdkRGBA>.

the current system accent color

Method: style-manager:get-color-scheme self ⇒ %return
Method: get-color-scheme self ⇒ %return

Gets the requested application color scheme.

self

Passed: a <AdwStyleManager>.

a style manager

%return

Returned: a <AdwColorScheme>.

the color scheme

Method: style-manager:get-dark? self ⇒ %return
Method: get-dark? self ⇒ %return

Gets whether the application is using dark appearance.

This can be used to query the current appearance, as requested via StyleManager:color-scheme.

self

Passed: a <AdwStyleManager>.

a style manager

%return

Returned: a boolean.

whether the application is using dark appearance

Procedure: style-manager:get-default ⇒ %return

Gets the default <AdwStyleManager> instance.

It manages all <GdkDisplay> instances unless the style manager for that display has an override.

See StyleManager.get_for_display.

%return

Returned: a <AdwStyleManager>.

the default style manager

Method: style-manager:get-display self ⇒ %return
Method: get-display self ⇒ %return

Gets the display the style manager is associated with.

The display will be NULL for the style manager returned by StyleManager.get_default.

self

Passed: a <AdwStyleManager>.

a style manager

%return

Returned: a <GdkDisplay>, or #f.

the display

Method: style-manager:get-document-font-name self ⇒ %return
Method: get-document-font-name self ⇒ %return

Gets the system document font.

The font is in the same format as settings:gtk-font-name, e.g. "Adwaita Sans 12".

Use font-description:from-string to parse it.

self

Passed: a <AdwStyleManager>.

a style manager

%return

Returned: a string.

the system document font

Procedure: style-manager:get-for-display display ⇒ %return

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 StyleManager.get_default instead.

display

Passed: a <GdkDisplay>.

a <GdkDisplay>

%return

Returned: a <AdwStyleManager>.

the style manager for display

Method: style-manager:get-high-contrast? self ⇒ %return
Method: get-high-contrast? self ⇒ %return

Gets whether the application is using high contrast appearance.

This cannot be overridden by applications.

self

Passed: a <AdwStyleManager>.

a style manager

%return

Returned: a boolean.

whether the application is using high contrast appearance

Method: style-manager:get-monospace-font-name self ⇒ %return
Method: get-monospace-font-name self ⇒ %return

Gets the system monospace font.

The font is in the same format as settings:gtk-font-name, e.g. "Adwaita Mono 11".

Use font-description:from-string to parse it.

self

Passed: a <AdwStyleManager>.

a style manager

%return

Returned: a string.

the system monospace font

Method: style-manager:get-system-supports-accent-colors? self ⇒ %return
Method: get-system-supports-accent-colors? self ⇒ %return

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 StyleManager:accent-color.

self

Passed: a <AdwStyleManager>.

a style manager

%return

Returned: a boolean.

whether the system supports accent colors

Method: style-manager:get-system-supports-color-schemes? self ⇒ %return
Method: get-system-supports-color-schemes? self ⇒ %return

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.

self

Passed: a <AdwStyleManager>.

a style manager

%return

Returned: a boolean.

whether the system supports color schemes

Method: style-manager:set-color-scheme self color-scheme
Method: set-color-scheme self 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 StyleManager:dark property can be used to query the current effective appearance.

The Adw.ColorScheme.prefer-light color scheme results in the application using light appearance unless the system prefers dark colors. This is the default value.

The Adw.ColorScheme.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.ColorScheme.force-light and Adw.ColorScheme.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 Adw.ColorScheme.default, it will inherit the color scheme from the default style manager.

For the default style manager, Adw.ColorScheme.default is equivalent to Adw.ColorScheme.prefer-light.

The StyleManager:system-supports-color-schemes property can be used to check if the current environment provides a color scheme preference.

self

Passed: a <AdwStyleManager>.

a style manager

color-scheme

Passed: a <AdwColorScheme>, or one of its symbols.

the color scheme