Expand description
Procedural, asset-free avatar generation driven by stable identity hashes.
The crate produces deterministic avatar images from an input identifier without shipping image packs, sprites, or third-party artwork. All visual output is drawn from code using geometric primitives.
Typical usage:
use hashavatar::{
AvatarBackground, AvatarKind, AvatarOptions, AvatarOutputFormat, AvatarSpec,
encode_avatar_for_id,
};
let bytes = encode_avatar_for_id(
AvatarSpec::new(256, 256, 0),
"alice@example.com",
AvatarOutputFormat::WebP,
AvatarOptions {
kind: AvatarKind::Robot,
background: AvatarBackground::White,
},
)?;Structs§
- Avatar
Identity - A stable avatar identity derived from a SHA-512 digest.
- Avatar
Namespace - Avatar
Options - Avatar
Spec - Input parameters for a generated avatar image.
- CatAvatar
- Cat-face avatar renderer built from simple geometric primitives.
- Color
- RGBA color helper for concise shape drawing.
- Hashed
CatAvatar - Cat-face avatar renderer driven by a SHA-512 identity.
- Hashed
DogAvatar - Hashed
Robot Avatar
Enums§
- Avatar
Background - Avatar
Kind - Avatar
Output Format - Export formats for encoded avatar assets.
Constants§
- AVATAR_
STYLE_ VERSION - Rendering contract version for deterministic avatars.
Traits§
- Avatar
Renderer - Trait for renderers that can draw reusable avatar styles onto an image buffer.
Functions§
- encode_
avatar - Render and encode an avatar into memory.
- encode_
avatar_ for_ id - encode_
avatar_ for_ namespace - encode_
cat_ avatar - Render and encode a cat avatar into memory.
- encode_
cat_ avatar_ for_ id - Render and encode a cat avatar for a stable identity string.
- export_
avatar - Render and write an avatar to disk.
- export_
avatar_ svg_ for_ id - export_
avatar_ svg_ for_ namespace - export_
cat_ avatar - Render and write a cat avatar to disk.
- export_
cat_ avatar_ for_ id - Render and write a cat avatar for a stable identity string.
- render_
alien_ avatar_ for_ identity - render_
avatar_ for_ id - Render an avatar image directly without encoding it.
- render_
avatar_ for_ namespace - render_
avatar_ svg_ for_ id - Render an avatar as a compact SVG string.
- render_
avatar_ svg_ for_ namespace - render_
bird_ avatar_ for_ identity - render_
cat_ avatar - Render a cat face avatar into an RGBA image.
- render_
cat_ avatar_ for_ identity - Render a cat face avatar from a SHA-512-backed identity.
- render_
cat_ avatar_ for_ identity_ with_ background - render_
dog_ avatar_ for_ identity - render_
fox_ avatar_ for_ identity - render_
ghost_ avatar_ for_ identity - render_
monster_ avatar_ for_ identity - render_
paws_ avatar_ for_ identity - render_
robot_ avatar_ for_ identity - render_
skull_ avatar_ for_ identity - render_
slime_ avatar_ for_ identity - render_
wizard_ avatar_ for_ identity