Expand description
Deterministic pixel-art avatars from any seed.
monster and nerd draw 8x8 faces, face picks one of the two by
the seed, crest draws a 10x10 shield with a division and an emblem,
badge a 12x12 round badge with a division, an emblem and sometimes
a rim, realm a 20x20 floating island, planet or patch of sea,
retro a 20x20 game sprite, and icon picks a realm or a retro
sprite by the seed.
The seed is any byte string, typically a public user or group id.
let avatar = gsichtl::face(b"alice");
let image = avatar.to_rgba(12, 16);
assert_eq!(image.width, 8 * 12 + 2 * 16);§Stability
The same seed gives the same avatar within a 0.x minor version. Changing
a part, a palette, the draw order or a context string is a breaking change
and bumps the minor version, because everyone who draws an avatar for the
same id has to see the same picture.
§Not an identity check
Anyone can upload a picture that looks like another person’s generated face. A generated avatar is a decoration; never present it as verification of who someone is.
Structs§
- Avatar
- A square grid of colored cells on a background.
- Rgba
- An RGBA8 image, row-major, with straight (not premultiplied) alpha.
Enums§
- Kind
- What a generator drew.
Functions§
- badge
- A 12x12 round badge, for groups.
- crest
- A 10x10 crest, for groups.
- face
- A monster or a nerd, chosen by the seed.
- icon
- A realm or a retro sprite, chosen by the seed: the group counterpart of
face. Made to stand free: render it withAvatar::to_rgba_transparent. - monster
- An 8x8 monster.
- nerd
- An 8x8 nerdy human face.
- realm
- A 20x20 realm, for groups: a floating island, a planet or a floating
patch of sea, with a landmark. Half of all realms are islands. Made to
stand free: render it with
Avatar::to_rgba_transparent. - retro
- A 20x20 retro game sprite, for groups: a creature, a weapon, an item or
a piece of old tech in neon colors, sometimes in front of an explosion,
a blood splatter or sparkles. Made to stand free: render it with
Avatar::to_rgba_transparent.
Type Aliases§
- Rgb
- An sRGB color.