adw.avatar

Module for [Avatar] class

Types 3

A widget displaying an image, with a generated fallback.

avatar

[adw.avatar.Avatar] is a widget that shows a round avatar.

[adw.avatar.Avatar] generates an avatar with the initials of the property@Avatar:text on top of a colored background.

The color is picked based on the hash of the property@Avatar:text.

If property@Avatar:show-initials is set to FALSE, property@Avatar:icon-name or avatar-default-symbolic is shown instead of the initials.

Use property@Avatar:custom-image to set a custom image.

CSS nodes

[adw.avatar.Avatar] has a single CSS node with name avatar.

Methods
GType _gType() @property
Avatar self()Returns `this`, for use in `with` statements.
AvatarGidBuilder builder()Get builder for [adw.avatar.Avatar] Returns: New builder object
gdk.paintable.Paintable customImage() @propertyGet `customImage` property. Returns: A custom image paintable.
void customImage(gdk.paintable.Paintable propval) @propertySet `customImage` property. Params: propval = A custom image paintable.
string iconName() @propertyGet `iconName` property. Returns: The name of an icon to use as a fallback.
void iconName(string propval) @propertySet `iconName` property. Params: propval = The name of an icon to use as a fallback.
bool showInitials() @propertyGet `showInitials` property. Returns: Whether initials are used instead of an icon on the fallback avatar.
void showInitials(bool propval) @propertySet `showInitials` property. Params: propval = Whether initials are used instead of an icon on the fallback avatar.
int size() @propertyGet `size` property. Returns: The size of the avatar.
void size(int propval) @propertySet `size` property. Params: propval = The size of the avatar.
string text() @propertyGet `text` property. Returns: Sets the text used to generate the fallback initials and color.
void text(string propval) @propertySet `text` property. Params: propval = Sets the text used to generate the fallback initials and color.
gdk.texture.Texture drawToTexture(int scaleFactor)Renders self into a [gdk.texture.Texture] at scale_factor.
gdk.paintable.Paintable getCustomImage()Gets the custom image paintable. Returns: the custom image
string getIconName()Gets the name of an icon to use as a fallback. Returns: the icon name
bool getShowInitials()Gets whether initials are used instead of an icon on the fallback avatar. Returns: whether initials are used instead of an icon as fallback
int getSize()Gets the size of the avatar. Returns: the size of the avatar
string getText()Gets the text used to generate the fallback initials and color. Returns: the text used to generate the fallback initials and color
void setCustomImage(gdk.paintable.Paintable customImage = null)Sets the custom image paintable.
void setIconName(string iconName = null)Sets the name of an icon to use as a fallback.
void setShowInitials(bool showInitials)Sets whether to use initials instead of an icon on the fallback avatar.
void setSize(int size)Sets the size of the avatar.
void setText(string text = null)Sets the text used to generate the fallback initials and color.
Constructors
this(void * ptr, Flag!"Take" take)
this(int size, string text, bool showInitials)Creates a new [adw.avatar.Avatar].
Methods
T customImage(gdk.paintable.Paintable propval)Set `customImage` property. Params: propval = A custom image paintable.
T iconName(string propval)Set `iconName` property. Params: propval = The name of an icon to use as a fallback.
T showInitials(bool propval)Set `showInitials` property. Params: propval = Whether initials are used instead of an icon on the fallback avatar.
T size(int propval)Set `size` property. Params: propval = The size of the avatar. Returns: Builder instance for fluent chaining
T text(string propval)Set `text` property. Params: propval = Sets the text used to generate the fallback initials and color.

Fluent builder for [adw.avatar.Avatar]

Methods