# re-avataaars

> Avataaars as a API

Latest version **0.1.1** (published 2020-03-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install re-avataaars
pnpm add re-avataaars
yarn add re-avataaars
bun add re-avataaars
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2020-03-14 |
| First published | 2020-03-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 375.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Kerolos Zaki |
| Maintainers | ker0olos |

## Links

- npm: https://www.npmjs.com/package/re-avataaars
- Repository: https://github.com/ItsKerolos/avataaars
- Homepage: https://github.com/ItsKerolos/avataaars#readme
- Issues: https://github.com/ItsKerolos/avataaars/issues
- npm.io page: https://npm.io/package/re-avataaars

## Recent versions

- 0.1.1 (latest) — 2020-03-14
- 0.1.0 — 2020-03-11

## README

<img src='avataaars-example.png' style='width: 128px; height: 136px;'/>

Original React library was developed by [Fang-Pen Lin](https://twitter.com/fangpenlin), based on a [Sketch library](https://avataaars.com/) designed by [Pablo Stanley](https://twitter.com/pablostanley).

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](/examples/gcloud-functions).
  - 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](https://getavataaars.com)

## Usage

```
npm install re-avataaars --save
```

```js
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.

```js
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.

---
_Source: https://npm.io/package/re-avataaars · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
