| Crates.io | animatar-cli |
| lib.rs | animatar-cli |
| version | 1.0.1 |
| created_at | 2025-11-08 10:53:06.027225+00 |
| updated_at | 2025-11-08 11:02:55.689438+00 |
| description | CLI tool for generating unique animal avatars. |
| homepage | |
| repository | https://github.com/luizvbo/animatar |
| max_upload_size | |
| id | 1922759 |
| size | 18,960 |
A blazingly fast, type-safe Rust port of the popular animal-avatar-generator library.
This project generates unique, deterministic SVG animal avatars from a seed string. It is a 1:1 port, ensuring that a given seed produces the exact same avatar as the original JavaScript library.
It can be used as both a Rust library in your own projects and as a standalone command-line tool.
animatar) in your Rust apps, or as a
standalone CLI tool (animatar-cli).This project is split into two crates: a library and a command-line tool.
animatar)Add the library to your project's Cargo.toml:
[dependencies]
animatar = "1.0.0" # Replace with the latest version
Then, use the avatar function to generate an SVG string:
use animatar::{avatar, AvatarOptions};
fn main() {
// Use default options
let svg_default = avatar("my-seed-string", &AvatarOptions::default());
// Or, customize the options
let custom_options = AvatarOptions {
size: 400,
round: false,
avatar_colors: &["#c27f5b", "#734933"],
background_colors: &["#f2d3b8"],
..Default::default()
};
let svg_custom = avatar("another-seed", &custom_options);
println!("{}", svg_custom);
// <svg ...>...</svg>
}
animatar-cli)You can install the CLI directly from crates.io or download pre-compiled
binaries from the GitHub
Releases page.
cargo install animatar-cli
Provide a seed string as a positional argument. The SVG output is printed to standard output, so you can redirect it to a file.
animatar-cli "my-favorite-seed" > avatar.svg
Use flags to customize the output. For example, to create a 500px square avatar with custom colors:
animatar-cli "custom-avatar" \
--size 500 \
--no-round \
--avatar-colors="#ff0000,#00ff00" \
--background-colors="#000000" \
> square_avatar.svg
All options are available in both the library (AvatarOptions struct) and the CLI.
| Option | Type | CLI Flag | Default | Description |
|---|---|---|---|---|
seed |
String |
(positional) | (required) | The input string used to generate the avatar. |
size |
u32 |
--size <SIZE> |
150 |
Avatar size in pixels. |
round |
bool |
--no-round |
true |
Use a round shape. The flag makes it square. |
blackout |
bool |
--no-blackout |
true |
Apply a subtle blackout effect to the right side. |
avatar_colors |
Vec<&str> |
--avatar-colors <COLORS> |
['#d7b89c', ...] |
Comma-separated list of hex colors for the avatar. |
background_colors |
Vec<&str> |
--background-colors <COLORS> |
['#fcf7d1', ...] |
Comma-separated list of hex colors for the background. |
Contributions are welcome! This project is set up with a full suite of automated checks to ensure high code quality.
Please read the CONTRIBUTING.md file for guidelines on how to set up your development environment and submit a pull request.
This project is a Rust port of the excellent animal-avatar-generator TypeScript library by Roman Lukashik.
The core logic, SVG shapes, and overall concept are based entirely on the original work. Please be sure to check out and star the original repository!
This project is licensed under the MIT License. See the LICENSE file for details.