avatar-icon
TypeScript icon, indicating that this package has built-in type declarations

1.1.5 • Public • Published

avatar icon generator

A simple avatar generator script for Node.js (on npm).

avatar-icon-1 avatar-icon-2 avatar-icon-3 avatar-icon-4

avatar-icon-5 avatar-icon-6 avatar-icon-7 avatar-icon-8

avatar-icon-9 avatar-icon-10 avatar-icon-11 avatar-icon-12

avatar-icon-13 avatar-icon-14 avatar-icon-15 avatar-icon-16

avatar-icon-17 avatar-icon-18 avatar-icon-19 avatar-icon-20

install and usage

npm i avatar-icon

import/require

import avatarIcon from 'avatar-icon'
// const avatarIcon = require('avatar-icon')

dataURL

let dataURL = avatarIcon()

// <img src={{dataURL}} alt="">

image file

import fs from 'fs'
// const fs = require('fs')

let buffer = avatarIcon({
  returnType: 'buffer'
})

fs.writeFileSync('./icon.png', buffer)

options and defaults

let icon = avatarIcon({
  size            : 72,   // px
  density         : 10,   // max amount of shapes in one row
  colorRange      : 12,   // amount of different colors
  brightness      : 40,   // make it bright: start at 40 from 255 colors
  contrast        : 50,   // %, take similar colors
  backgroundColor : '',   // #hex or empty
  fillRatio       : 60,   // %, some white space
  rectangleRatio  : 60,   // %, ratio of rectangles
  triangleRatio   : 40,   // %, ratio of triangles
  circleRatio     : 0,    // %, ratio of circles
  returnType      : '',   // default dataURL || 'buffer'
});

Readme

Keywords

Package Sidebar

Install

npm i avatar-icon

Weekly Downloads

21

Version

1.1.5

License

MIT

Unpacked Size

42.1 kB

Total Files

25

Last publish

Collaborators

  • ztom