Skip to main content

Module recipe_avatar_style

Module recipe_avatar_style 

Source
Expand description

Default AvatarStyle impl driven by paint-recipe data.

RecipeAvatarStyle ports the IntUI avatar chrome exactly: the shape-aware background fill (with hash-derived palette pick when no caller override is supplied), the optional border ring drawn over the inner content to mask any image bleed at the rim, the keyboard focus ring hugging the configured shape, and the presence indicator dot positioned at one of the four corners with a surface_main-coloured outline.

The chrome helpers (hash_pick_palette_color, auto_contrast_text, paint_border, paint_focus_ring, fnv1a_64, avatar_pixel_size) live here so custom AvatarStyle implementations can reuse them when they only want to swap one piece of the chrome.

Structs§

AvatarRecipe
Dimension recipe for RecipeAvatarStyle.
RecipeAvatarStyle
Default AvatarStyle shipped with Teksilo.

Constants§

AVATAR_BORDER_DEFAULT
Default border (ring) thickness when .border() is called without an explicit width override.
AVATAR_FONT_RATIO_1CHAR
Initials font-size as a fraction of avatar diameter.
AVATAR_FONT_RATIO_2CHAR
AVATAR_PRESENCE_DIAMETER_MAX
AVATAR_PRESENCE_DIAMETER_MIN
AVATAR_PRESENCE_DIAMETER_RATIO
Presence dot diameter as a fraction of avatar diameter.
AVATAR_PRESENCE_INSET
Inset of the presence dot from the avatar’s bounding box edge.
AVATAR_PRESENCE_OUTLINE_WIDTH
Outline drawn around the presence dot.
AVATAR_ROUNDED_RADIUS_RATIO
Corner-radius ratio for AvatarShape::RoundedSquare.
AVATAR_SIZE_LARGE
AVATAR_SIZE_MEDIUM
AVATAR_SIZE_SMALL
AVATAR_SIZE_X_LARGE

Functions§

auto_contrast_text
Auto-contrast foreground for a given background.
avatar_pixel_size
Resolve a discrete AvatarSize to a logical-pixel side length using the recipe’s size table. Custom(px) is clamped to at least 1 px.
fnv1a_64
FNV-1a 64-bit hash — deterministic palette-bucket selection.
hash_pick_palette_color
Pick a colour from the theme’s chart palette deterministically from seed. Empty palette falls back to a neutral grey so the widget still renders.
paint_border
Stroke a border ring inside the avatar’s content bounds.
paint_focus_ring
Stroke a focus ring outside the avatar’s content bounds. Hugs the configured shape so a square avatar gets a square ring.