New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

re-avataaars

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

re-avataaars

Avataaars as a API

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

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.

FAQs

Package last updated on 14 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts