Generate robot-based avatar images based on any text.
After installing, simply import Robohash Avatars in your file.
const robohashAvatars = require("robohash-avatars");
Consume the generateAvatar()
API to get an avatar URL that you can use directly as an image. Supply the settings object to this method to generate the avatar image URL accordingly. Username is required. For the remainder, you can supply them based on your requirement. All settings are pretty self-explanatory.
var avatarURL = robohashAvatars.generateAvatar({
username: "tonystark",
background: robohashAvatars.BackgroundSets.RandomBackground1,
characters: robohashAvatars.CharacterSets.Kittens,
height: 400,
width: 400
});
CharacterSets
supports Robots
, Monsters
, DisembodiedHeads
and Kittens
. BackgroundSets
supports RandomBackground1
and RandomBackground2
Clicking on the images below opens the image in a browser window.
Release notes can be found here.
RoboHash.org is developed by Colin Davis / RoboHash GitHub.
This npm package is developed by Clyde D'Souza.