1.0.3 • Published 10 months ago

simple-generic-avatar v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
10 months ago

Simple Generic Avatar

simple-generic-avatar is a lightweight(kind of) npm package that generates a simple avatar as an SVG. The avatar displays initials based on a given name with colors and comes with different sizes.

Usage/Examples

import { generateAvatar } from 'simple-generic-avatar';

const myImage = generateAvatar('John', 'Doe', 32, 'violet');

function ReactApp() {
	<img src={myImage} />;
}

Image can be used as an 'src' in design librariers or frameworks such as NextJS and it's tag.

import { generateAvatar } from 'simple-generic-avatar'

const myImage = generateAvatar("John", "Doe", 32, "violet")

function NextApp() {
    <Image src={myImage} //... rest of the parameters />
}

Documentation

Package exports single function named generateAvatar. There are only 4 values that can be passed as props:

  • name - John
  • surname - Doe
  • size - Square format only, ex. 16 - 16x16, 64 - 64x64 etc.
  • color? - Color as a one of the given string values (ex. "red"). If not provided, color will be randomized.

Authors

License

MIT

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago