Class: Handy::StyleManager

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.defaultHandy::StyleManager

Gets the default [classStyleManager] instance.

It manages all [classGdk.Display] instances unless the style manager for that display has an override.

See [funcStyleManager.get_for_display].

Returns:

.get_for_display(display) ⇒ Handy::StyleManager

Gets the [classStyleManager] instance managing display.

It can be used to override styles for that specific display instead of the whole application.

Most applications should use [funcStyleManager.get_default] instead.

Parameters:

  • display (Gdk::Display)

    a display

Returns:

Instance Method Details

#color_schemeHandy::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 [propertyStyleManager: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-[classGdk.Display] 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 [propertyStyleManager:system-supports-color-schemes] property can be used to check if the current environment provides a color scheme preference.

Returns:

#color_scheme=(color_scheme) ⇒ Handy::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 [propertyStyleManager: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-[classGdk.Display] 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 [propertyStyleManager:system-supports-color-schemes] property can be used to check if the current environment provides a color scheme preference.

Parameters:

Returns:

#darkBoolean

Gets whether the application is using dark appearance.

Returns:

  • (Boolean)

    whether the application is using dark appearance

#dark=(dark) ⇒ Boolean

Whether the application is using dark appearance.

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

Parameters:

  • dark (Boolean)

Returns:

  • (Boolean)

    dark

  • (Boolean)

    dark

#dark?Boolean

Whether the application is using dark appearance.

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

Returns:

  • (Boolean)

    dark

#displayGdk::Display

The display the style manager is associated with.

The display will be NULL for the style manager returned by [funcStyleManager.get_default].

Returns:

  • (Gdk::Display)

    display

#display=(display) ⇒ Gdk::Display

The display the style manager is associated with.

The display will be NULL for the style manager returned by [funcStyleManager.get_default].

Parameters:

  • display (Gdk::Display)

Returns:

  • (Gdk::Display)

    display

  • (Gdk::Display)

    display

#high_contrastBoolean

Gets whether the application is using high contrast appearance.

Returns:

  • (Boolean)

    whether the application is using high contrast appearance

#high_contrast=(high_contrast) ⇒ Boolean

Whether the application is using high contrast appearance.

This cannot be overridden by applications.

Parameters:

  • high_contrast (Boolean)

Returns:

  • (Boolean)

    high-contrast

  • (Boolean)

    high-contrast

#high_contrast?Boolean

Whether the application is using high contrast appearance.

This cannot be overridden by applications.

Returns:

  • (Boolean)

    high-contrast

#system_supports_color_schemesBoolean

Gets whether the system supports color schemes.

Returns:

  • (Boolean)

    whether the system supports color schemes

#system_supports_color_schemes=(system_supports_color_schemes) ⇒ Boolean

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 [propertyStyleManager:color-scheme].

Parameters:

  • system_supports_color_schemes (Boolean)

Returns:

  • (Boolean)

    system-supports-color-schemes

  • (Boolean)

    system-supports-color-schemes

#system_supports_color_schemes?Boolean

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 [propertyStyleManager:color-scheme].

Returns:

  • (Boolean)

    system-supports-color-schemes