glyphatar 0.2.0

Deterministic, mirror-symmetric SVG identicons built from simple shapes
Documentation
  • Coverage
  • 100%
    6 out of 6 items documented1 out of 6 items with examples
  • Size
  • Source code size: 25.8 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 127.7 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 2s Average build duration of successful builds.
  • all releases: 2s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • jdlunger/glyphatar
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • jdlunger

glyphatar

Deterministic SVG identicons ("glyph avatars") built from simple shapes. I didn't like any similar existing libraries.

This is a first version created with Claude. If it sees any kind of usage I will revisit with a human eye. No dependencies (except for the test, to confirm the SHA256 implementation.)

Eight sample glyphatars

Live demo: try it with your own text or bytes.

// Any bytes: a public key, a user id, an email hash…
let svg: String = glyphatar::svg(b"some public key bytes", 64);

// With a <title> for screen readers and hover tooltips:
let svg = glyphatar::Glyphatar::new(b"alice").to_svg_with_title(64, "alice");
  • The input is hashed with SHA-256, so it can be any length.
  • The output is a small SVG with one <path> per colour, a transparent background and hex colours, so it renders anywhere.
  • Stable output: the same input renders the same glyph within a major version. Any visual change is a breaking release.
    • Note: pre-1.0, I'll probably make some breaking changes - contact me if you want to use this seriously before that :)

To browse random glyphs, run cargo run --example serve and open http://localhost:3001. Refresh for new ones.

License

MIT

Development

Publish

  1. Bump Cargo.toml version
  2. cargo check
    
  3. Commit
  4. git tag v1.2.3
    git push origin main v1.2.3
    

Live Demo

cd demo
cargo build --release --target wasm32-unknown-unknown
python3 -m http.server