re-avataaars

0.1.1 • Public • Published

Original React library was developed by Fang-Pen Lin, based on a Sketch library designed by Pablo Stanley.

This is a rewrite of Fang-Pen Lin's work but as a API, this allow it to be used for things like:

  • Serverless function.
  • Generating an avatar from your terminal.
  • Use it inside any web framework.

Being a rewrite we removed, added and renamed stuff so this is not compatible with things like https://getavataaars.com

Usage

npm install re-avataaars --save
import avatar, { clotheColors } from 're-avataaars'

// this outputs a svg xml string
const svg = avatar({
  topType: 'long-hair-curly',
  clothType: 'shirt-v-neck',
  clotheColor: clotheColors.pastelOrange
});

// you can add it directly to DOM (browser)
document.getElementById('foo').innerHTML = svg;

// save it to a file (nodejs)
require('fs').writeFileSync('avatar.svg', svg);

You can use the piece function to show individual pieces of an avatar.

import { piece, clotheColors } from 're-avataaars'

const svg = piece('clothe', {
  clothType: 'graphics',
  clotheColor: '#000000',
  clotheGraphic: 'pizza'
}, { size: '268' });

Check the examples folder if you want to see more ways to use this module.

Readme

Keywords

none

Package Sidebar

Install

npm i re-avataaars

Weekly Downloads

0

Version

0.1.1

License

MIT

Unpacked Size

384 kB

Total Files

15

Last publish

Collaborators

  • ker0olos