Skip to content

eric-musliner/identicon-kit

IdenticonKit


Swift Version License Build Status

A Cross-platform Swift package for generating unique, block-based identicon images. Perfect for creating consistent default avatars for your users or any data-driven visual representation.

Features

  • Customizable Identicons: Generate unique blocky avatars from various input types (e.g., user IDs, email hashes).
  • Pure Swift: Designed to work seamlessly across Swift platforms, including server-side environments like Vapor.
  • Lightweight: Minimal dependencies, ensuring a small footprint.

Examples


Installation

You can add IdenticonKit to your project using Swift Package Manager.

Swift Package Manager

Add the following to your Package.swift file:

dependencies: [
    .package(url: "https://github.com/eric-musliner/identicon-kit.git", from: "1.2.0")
]

Usage

To create an Identicon in svg format

  let svg = IdenticonKit.generateSvg(from: "test@example.com")

  // Specify larger grid of elements (.xsmall, .small, .medium, .large)
  let svg = IdenticonKit.generate(from: "test@example.com", size: .medium)

Development

Linux

Build or run tests with:

swift build \
  -Xcc -I/usr/include/c++/11 \
  -Xcc -I/usr/include/x86_64-linux-gnu/c++/11
swift test \
  -Xcc -I/usr/include/c++/11 \
  -Xcc -I/usr/include/x86_64-linux-gnu/c++/11 \
  -Xlinker -L/usr/lib/gcc/x86_64-linux-gnu/11

About

A Cross-Platform Swift library for generating unique identicons from hashes of user IDs

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages