pub struct Avatar { /* private fields */ }Expand description
A circular profile avatar with initials and an optional presence dot.
ui.add(
Avatar::new("AL")
.size(AvatarSize::Large)
.tone(AvatarTone::Sky)
.presence(AvatarPresence::Online),
);Implementations§
Source§impl Avatar
impl Avatar
Sourcepub fn new(initials: impl Into<WidgetText>) -> Self
pub fn new(initials: impl Into<WidgetText>) -> Self
Create an avatar that displays the given initials. One or two
uppercase glyphs read best ("AL", "MR", "??").
Sourcepub fn size(self, size: AvatarSize) -> Self
pub fn size(self, size: AvatarSize) -> Self
Pick a size preset. Default: AvatarSize::Medium.
Sourcepub fn tone(self, tone: AvatarTone) -> Self
pub fn tone(self, tone: AvatarTone) -> Self
Pin the tone explicitly. When unset, the tone is derived from the initials so the same name always gets the same colour.
Sourcepub fn presence(self, presence: AvatarPresence) -> Self
pub fn presence(self, presence: AvatarPresence) -> Self
Render a presence dot in the bottom-right corner. Default: none.
Sourcepub fn surface(self, color: Color32) -> Self
pub fn surface(self, color: Color32) -> Self
Override the surface colour the avatar is painted against. Drives
the inner border on the presence dot and the colour of the outer
ring (when Avatar::ring is set). Defaults to the page
background; pass theme.palette.card when placing an avatar inside
a Card so the presence dot punches cleanly out of
the card surface.
Sourcepub fn ring(self, ring: bool) -> Self
pub fn ring(self, ring: bool) -> Self
Paint a 2 pt outer ring in the surface colour around the disc. Used
by AvatarGroup to separate overlapping members; rarely needed
for solo avatars. Default: off.