Skip to main content

Module avatar

Module avatar 

Source
Expand description

Avatar — circular (or rounded-square / square) user-identity widget.

Displays either a person’s image (clipped to the configured shape via a CPU-side anti-aliased alpha mask applied at construction time) or their initials over a hash-derived background colour. Optional presence indicator (Online / Offline / Away / Busy) and outer ring. Can be made activable to serve as a user-menu trigger.

// Image with a presence dot.
let _w = Avatar::with_image(&face)
    .alt(lit!("Jane Doe"))
    .presence(AvatarPresence::Online)
    .size(AvatarSize::Medium);

// Hash-tinted initials, auto-derived from a name.
let _w = Avatar::with_name(lit!("Jane Doe")).size(AvatarSize::Large);

// Click target — opens a user menu via an intent.
let _w = Avatar::with_image(&face)
    .label(lit!("Open user menu"))
    .alt(lit!("Jane Doe"))
    .on_activate_fn(|ctx| ctx.send_intent(Intent::new("app.open-user-menu")));

The widget reuses ImageWidget for the image path and draws bg / border / presence directly via Canvas. Hash-derived background tints come from theme.colors.chart_palette (Okabe-Ito), so they track the active theme automatically.

Structs§

Avatar
Circular (or rounded-square / square) user-identity widget showing either a photo or hash-tinted initials, with an optional presence dot.

Enums§

AvatarCorner
Where the presence dot is rendered relative to the avatar bounds.
AvatarPresence
Presence indicator dot drawn at one corner of the avatar.
AvatarShape
Outer outline.
AvatarSize
Discrete avatar size variants. Custom(px) accepts an arbitrary logical-pixel side length. The default size resolution table lives in teksilo_widgets::styles::recipe_avatar_style::avatar_pixel_size.