avatar-icon
v1.1.5
Published
A simple avatar generator script.
Downloads
21
Readme
avatar icon generator
A simple avatar generator script for Node.js (on npm).
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'
});