Skip to content

teapot-labs/identeapots

Repository files navigation

Indeteapots

Identeapots is a simple TypeScript library for generating identicon images.

Installation

npm i @teapotlabs/identeapots

Usage

The return value of the generateIdenteapot function is Data URL

import { generateIdenteapot } from "@teapotlabs/identeapots";

// data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAACPEAAAH0C...
const identicon: string = generateIdenteapot("hello world", "salt");

Which can be used in <img> tags as src attribute.

<img src={identicon} alt="Example Identeapot" />

This will generate the following image:

Example

A complete example of a NextJS application is available in the /test folder

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT