The name or identifier used to generate the avatar.
Optionaloptions: AvatarOptionsOptional customization settings for the avatar.
Defines the options for generating an SVG avatar.
OptionalbackgroundColor?: stringThe background color of the avatar (e.g., '#FF6600'). If not provided, a color will be deterministically generated from the username.
OptionalfontFamily?: stringThe font family for the initials. Defaults to 'Arial, sans-serif'.
OptionalfontSize?: numberThe font size for the initials. If not provided, it will be calculated based on avatar size.
Optionalheight?: numberThe height of the avatar in pixels. Defaults to 100.
OptionalinitialsLength?: numberThe maximum number of initials to display. Defaults to 2.
Optionalshape?: AvatarShapeThe shape of the avatar. Defaults to 'square'.
OptionalsvgAttributes?: { [key: string]: string }Additional SVG attributes to apply to the root
Optionaltext?: stringText to explicitly display on the avatar instead of generated initials.
If provided, initialsLength and username-based initial generation will be ignored.
OptionaltextColor?: stringThe color of the text (initials) on the avatar (e.g., '#FFFFFF'). If not provided, a contrasting color will be chosen based on the background.
Optionalwidth?: numberThe width of the avatar in pixels. Defaults to 100.
The generated avatar SVG as a string.
Generates an SVG avatar based on the provided username and customization options.