class Adw::StyleManager
- Adw::StyleManager
- GObject::Object
- Reference
- Object
Overview
A class for managing application-wide styling.
Adw::StyleManager
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 [property@StyleManager:color-scheme] property, and to query the current appearance, as well as whether a system-wide color scheme preference exists.
Defined in:
lib/gi-crystal/src/auto/adw-1/style_manager.crConstructors
-
.new
Initialize a new
StyleManager
. - .new(*, color_scheme : Adw::ColorScheme? = nil, dark : Bool? = nil, display : Gdk::Display? = nil, high_contrast : Bool? = nil, system_supports_color_schemes : Bool? = nil)
Class Method Summary
-
.default : Adw::StyleManager
Gets the default
Adw::StyleManager
instance. -
.for_display(display : Gdk::Display) : Adw::StyleManager
Gets the
Adw::StyleManager
instance managing @display. -
.g_type : UInt64
Returns the type id (GType) registered in GLib type system.
Instance Method Summary
-
#color_scheme : Adw::ColorScheme
Gets the requested application color scheme.
-
#color_scheme=(color_scheme : Adw::ColorScheme) : Nil
Sets the requested application color scheme.
-
#dark : Bool
Gets whether the application is using dark appearance.
- #dark? : Bool
-
#display : Gdk::Display
Gets the display the style manager is associated with.
- #display=(value : Gdk::Display?) : Gdk::Display?
-
#high_contrast : Bool
Gets whether the application is using high contrast appearance.
- #high_contrast? : Bool
-
#system_supports_color_schemes : Bool
Gets whether the system supports color schemes.
- #system_supports_color_schemes? : Bool
Instance methods inherited from class GObject::Object
bind_property(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags) : GObject::Binding
bind_property,
bind_property_full(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags, transform_to : GObject::Closure, transform_from : GObject::Closure) : GObject::Binding
bind_property_full,
data(key : String) : Pointer(Void)?
data,
finalize
finalize,
freeze_notify : Nil
freeze_notify,
getv(names : Enumerable(String), values : Enumerable(_)) : Nil
getv,
notify(property_name : String) : Nil
notify,
notify_by_pspec(pspec : GObject::ParamSpec) : Nil
notify_by_pspec,
notify_signal
notify_signal,
property(property_name : String, value : _) : Nil
property,
qdata(quark : UInt32) : Pointer(Void)?
qdata,
ref_count : UInt32
ref_count,
run_dispose : Nil
run_dispose,
set_data(key : String, data : Pointer(Void)?) : Nil
set_data,
set_property(property_name : String, value : _) : Nil
set_property,
steal_data(key : String) : Pointer(Void)?
steal_data,
steal_qdata(quark : UInt32) : Pointer(Void)?
steal_qdata,
thaw_notify : Nil
thaw_notify,
to_unsafe : Pointer(Void)
to_unsafe,
watch_closure(closure : GObject::Closure) : Nil
watch_closure
Constructor methods inherited from class GObject::Object
cast(obj : GObject::Object) : self
cast,
cast?(obj : GObject::Object) : self?
cast?,
new(pointer : Pointer(Void), transfer : GICrystal::Transfer)new new, newv(object_type : UInt64, parameters : Enumerable(GObject::Parameter)) : self newv
Class methods inherited from class GObject::Object
compat_control(what : UInt64, data : Pointer(Void)?) : UInt64
compat_control,
g_type : UInt64
g_type,
interface_find_property(g_iface : GObject::TypeInterface, property_name : String) : GObject::ParamSpec
interface_find_property,
interface_list_properties(g_iface : GObject::TypeInterface) : Enumerable(GObject::ParamSpec)
interface_list_properties
Constructor Detail
Class Method Detail
Gets the default Adw::StyleManager
instance.
It manages all Gdk::Display
instances unless the style manager for
that display has an override.
Gets the Adw::StyleManager
instance managing @display.
It can be used to override styles for that specific display instead of the whole application.
Most applications should use StyleManager#default
instead.
Instance Method Detail
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_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-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 [property@StyleManager:system-supports-color-schemes] property can be used to check if the current environment provides a color scheme preference.
Gets whether the application is using dark appearance.
This can be used to query the current appearance, as requested via [property@StyleManager:color-scheme].
Gets the display the style manager is associated with.
The display will be NULL
for the style manager returned by
StyleManager#default
.
Gets whether the application is using high contrast appearance.
This cannot be overridden by applications.
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
.