0.1.1 • Published 4 years ago

re-avataaars v0.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

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:

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.