Skip to main content

Module avatar

Module avatar 

Expand description

Avatar: a person’s (or an account’s) picture, or their initials when no picture exists.

An avatar is a person, so its fallback wears that person’s presence colour: the hue comes from their identity (PresenceHue::of_identity) or from the presence colour the caller already holds for them, never from a position in a list. The initials take one ink per palette, derived from the fill’s own hue to at least 4.5:1, so every person’s initials read alike (no black on one hue and white on the next). A person’s presence (PresenceStatus) shows as a ringed badge on the corner, in their colour. An app or a thing without a picture is a neutral square (AvatarFace::neutral). A picture is cover-fitted into the shape and may load lazily from an ImageStore; the initials stay until it lands.

Two forms with one geometry: the retained Avatar widget and the immediate AvatarFace painter for rows, gutters and clusters that a caller lays out itself.

Structs§

Avatar
A person’s avatar as a retained widget. See the module docs.
AvatarFace
Immediate-mode avatar: the same picture, initials, colour and shape as Avatar, painted into a rect the caller laid out.

Enums§

AvatarSize
How large an avatar is. Each size reads from the theme’s metrics, so it follows the UI scale.
PresenceStatus
Whether a person is there: the badge on their avatar’s corner.

Functions§

initial_ink
The initials ink on fill.
initials_fill
The fill a tinted avatar wears: the person’s presence colour, moved in lightness (never in hue) away from the initials’ ink until initials can reach small-text contrast on it. Presence hues sit at one mid lightness, where neither ink clears much more than 4.5:1; small bold letters on a saturated mid tone need the headroom.
initials_for_name
The first letters of the first and the last word, upper-cased: "Ada Lovelace" gives "AL", "Grace Brewster Hopper" gives "GH", "ada" gives "A". Words without a letter are skipped, so "Tilo 4" gives "T", never "T4".