npm.io
1.0.1 • Published 4 years ago

cyber-circle-identicon

Licence
MIT
Version
1.0.1
Deps
0
Size
29 kB
Vulns
0
Weekly
0
Stars
2

Cyber Circle Identicons

Examples

Despite 1 letter being different, the entire image is different.

Example 1 Cyber Circle

Cyber Circle

Example 2 Cyber Circle

Cyber_Circle

Example 3 Cyber Circle

Cyber-Circle

Example 4 Cyber Circle

Cyber circle

Example 5 Cyber Circle

cyber Circle

Example 6 Cyber Circle

cyber circle

Usage

npm install cyber-circle-identicon
Download on Node.js
import { createIdenticon } from 'cyber-circle-identicon';
import { writeFileSync } from 'fs';

const userIdenticon = createIdenticon('Hello World!');
writeFileSync('identicon.png', userIdenticon);
As a React <img> source
import { createIdenticon } from 'cyber-circle-identicon'

const ReactComponent = () => {
	const userIdenticon = createIdenticon('Hello World!');

	return (
		<img src={'data:image/png;base64,' + cyberCirclePNG.toString('base64')} />
	);
};

Documentation

CreateIdenticon

Returns a PNG buffer of a cyber circle generated from a string.

key: string - The key to generate the PNG from. For example, this is someone's username.

additionalOptions: object - An object of options for greater customization.

  • size: number - The size of the image.
  • clipped: boolean - Whether the image should be clipped to a circle, this should be false if your platform typically clips images to a circle.
  • compression: number - The compression level of the image, this corresponds with zlib compression.
  • smoothEdges: number - how much to smooth the edges of each element. This is synonymous to adding anti-aliasing.
  • overrideData: object - Overrides the default data, this is great for platforms with themes.

Contribute

Any contribution is greatly appreciated. Feel free to fork the repository and submit a pull request.

I will actively review all issues and pull requests.

Contributors
Kyle Smith contributor cyber circle

KyleSmith0905

Owner

Keywords