https://github.com/clydedz/robohash-avatars-npm
Generate robot-based avatar images for any text.
https://github.com/clydedz/robohash-avatars-npm
avatar avatar-generator avatars html javascript javascript-library npm npm-package picture profile-picture robohash robohash-avatar typescript user
Last synced: about 2 months ago
JSON representation
Generate robot-based avatar images for any text.
- Host: GitHub
- URL: https://github.com/clydedz/robohash-avatars-npm
- Owner: ClydeDz
- License: mit
- Created: 2019-05-29T08:39:45.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T17:44:20.000Z (almost 3 years ago)
- Last Synced: 2024-12-06T13:49:48.880Z (10 months ago)
- Topics: avatar, avatar-generator, avatars, html, javascript, javascript-library, npm, npm-package, picture, profile-picture, robohash, robohash-avatar, typescript, user
- Language: JavaScript
- Homepage: http://bit.ly/robohash-avatars
- Size: 223 KB
- Stars: 11
- Watchers: 3
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Robohash Avatars
Generate robot-based avatar images based on any text.
[](https://clydedsouza.visualstudio.com/RoboHash%20Avatars%20npm/_build/latest?definitionId=27)
[](https://clydedsouza.visualstudio.com/RoboHash%20Avatars%20npm/_build/latest?definitionId=27)
[](https://clydedsouza.visualstudio.com/RoboHash%20Avatars%20npm/_build/latest?definitionId=27)
[](https://sonarcloud.io/dashboard?id=ClydeDz_robohash-avatars-npm)
[](https://sonarcloud.io/dashboard?id=ClydeDz_robohash-avatars-npm)

[](http://bit.ly/robohash-avatars)## Usage
After installing, simply import Robohash Avatars in your file.```javascript
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.```javascript
var avatarURL = robohashAvatars.generateAvatar({
username: "tonystark",
background: robohashAvatars.BackgroundSets.RandomBackground1,
characters: robohashAvatars.CharacterSets.Kittens,
height: 400,
width: 400
});
```### Options
`CharacterSets` supports `Robots`, `Monsters`, `DisembodiedHeads` and `Kittens`. `BackgroundSets` supports `RandomBackground1` and `RandomBackground2`## Examples
> Clicking on the images below opens the image in a browser window.[](https://robohash.org/RobohashAvatarNPM?bgset=bg1&size=200x200) [](https://robohash.org/tonystark?bgset=bg2&set=set2&size=200x200)
[](https://robohash.org/peterparker?bgset=bg1&set=set4&size=200x200)
## Release notes
Release notes can be found [here](https://github.com/ClydeDz/robohash-avatars-npm/releases).
## Credits
[RoboHash.org](http://robohash.org) is developed by [Colin Davis](https://github.com/e1ven) / [RoboHash GitHub](https://github.com/e1ven/Robohash).
This npm package is developed by [Clyde D'Souza](https://clydedsouza.net).