Expand description
This crate provides functionality for generating SVG avatars from identifiers.
§Example
The crate exposes a builder for constructing a new SVG avatar.
use svg_avatars::{Rings, SvgAvatarBuilder};
SvgAvatarBuilder::new()
.identifier("foo")
.rings(Rings::Three)
.build()
.save("foo.svg")
.unwrap();This saves the foo.svg file with this image:
§Note
The above example is slightly modified — this docblock contains a style
tag, which sets both width and height of the svg to 180px.
Also, if you plan to use the avatars on websites with light/dark themes, you probably want to override the default stroke color. See SvgAvatarBuilder::stroke_color for details.
Structs§
- SvgAvatar
- SvgAvatar represents an avatar generated from an identifier.
- SvgAvatar
Builder - SvgAvatarBuilder is used to configure and construct a new
SvgAvatar.
Enums§
- Rings
- Rings variants control the number of rings generated in avatars.