Avatar
The round picture or coloured initial that stands for a person or an agent, with its props, sizes, hue rule and every place it is used.

Avatar is how Seed Exact shows who. It draws a person's profile picture as a circle, and when there is no picture it draws a green disc with the first letter of their name in white. It is a named component, defined in ui.contract L6-L21, and it is the most reused component in the app.

Two initial discs on the Me tab: the current identity at 56 points, another identity at 28. Each name gets its own green.
Picture avatars at 28 points in a document byline.

Props

Prop

Type

Effect

name

string

The accessible label of the avatar, the source of the initial, and the seed of the disc colour

url

string

The picture. Empty means draw the initial disc

size

number

Width and height in points

Anatomy

With a picture (url is not empty): one image, size by size, border-radius="50%", object-fit="cover", labelled with the name.

Without a picture: a row of the same size and radius, centred content, filled with hsl(avatarHue(name), 54%, 32%). Inside it one text: the first character of the name in upper case, or "?" when the name is empty, in ink.on-brand (white in both schemes) at weight 600. The letter is hidden from assistive technology (aria-hidden), because the disc already carries the name.

The hue

fn avatarHue(name: string): number = 127 + sum(name.toLowerCase().split("").map((c, i) => ("abcdefghijklmnopqrstuvwxyz0123456789".indexOf(c) + 2) * (i + 7))) % 49

Each character contributes its position in the alphabet plus digits (plus 2), weighted by where it sits in the name (index plus 7). The sum modulo 49 is added to 127, so the hue is always between 127 and 175: the green family, 151 plus or minus 24. Saturation is fixed at 54% and lightness at 32%. "bob" gives 21 + 128 + 27 = 176, 176 mod 49 = 29, hue 156. The same name always gets the same disc. The source comment says the range sits around the desktop app's identicon hue, and that white on every hue in the range keeps at least 4.5:1 contrast.

Sizes and the capped initial

Size

Where

Initial

56

Headers: the current identity on Me, Identity detail, the Author header

-exact-title2, capped at 24 points

40

Activity rows

-exact-footnote, capped at 12 points

28

Rows and inline: document byline, comments, agents, other identities

-exact-footnote, capped at 12 points

20

FacePile

-exact-footnote, capped at 12 points

The rule in code is size >= 48 for the large initial. The circle keeps its size at every text size, so the letter is capped with font-size="min(-exact-title2, 24px)" or min(-exact-footnote, 12px): it grows with Dynamic Type only until it would leave the disc. See Accessibility.

Used by

Where

Size

Line

FacePile, overlapping faces on cards and embeds

20

read.contract L109

Document, the byline, one per author, each a link to the author

28

read.contract L330

Author profile, the author header

56

read.contract L421

DiscussBubble, so every comment on Document, Thread and All comments

28

discuss.contract L59

Activity inbox, each activity row

40

activity.contract L100

Agents list, each agent row, always the initial (url="")

28

agents.contract L214

Me, the current identity row

56

me.contract L80

Me, other identities

28

me.contract L88

Identity detail, the header row

56

me.contract L171

vault.contract imports Avatar and does not call it: the Vault identity rows have no avatar.

Rules for use

    Pass a name a person would recognise. The callers resolve profile name, then key name, then short id before calling (Names, not identifiers).

    Use 56 for the one header avatar of a screen and 28 in rows. 20 and 40 each have a single owner.

    Do not wrap it in a border or a coloured ring. FacePile is the only caller that adds one, to separate overlapping faces.

    Do not add a tap of its own. Where an avatar is tappable (the byline), the caller wraps it in a link with a 44 point target.

Why it looks this way

DESIGN.md asks for "Circle; initials on -exact-fill when no image": a neutral grey disc. The built component is green with a white initial, picked from the name. The file comment gives the reason: the same author keeps the same disc, as in the React Native app's hueFor, and the green family ties people to the Seed brand teal (Color and tokens). The screenshots in final/ still show the grey disc and are older; the fixes/ screenshots above show the built look. DESIGN.md also lists only sizes 28 and 56; the code adds 20 and 40.

Related

Do you like what you are reading? Subscribe to receive updates.

Unsubscribe anytime