AvataaarsJs
A vanilla javascript library to generate Avataaars on the client or server side!
Install / Use
/learn @HB0N0/AvataaarsJsREADME
<img src="https://github.com/HB0N0/AvataaarsJs/raw/main/header_img.png"></img>
Use the awesome Avataaars Library by Pablo Stanley (avataaars.com) in any javascript application.
This Project uses parts of the Dicebear Avatars Library to generate Avatars with a specified configuration.
I fitted this Library for my puposes, if you need functionalitys like random avatar generation or avatars based on seeds have a look at the DiceBear Avatars Library.
The main intention is to have all configuration options in one single file with a simple, extensible structure.
Getting Started
Include the JavaScript file into your application
<script src="avataaars.js"></script>
The default Avatar
The Library dont uses any random features, so if you dont specify any paramter it will return the same Avatar every time.
Avataaars.create();
// --> "<svg width [...] </svg>"
Customize Avatar
Avaliable options:
| name | type | default | description |
|------------------|--------|------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| width | number | null | Fixed width |
| height | number | null | Fixed height |
| style | string | circle | One of: transparent, circle |
| background | string | null | Background color for style: 'circle' |
| svgBackground | string | transparent | Background color for the whole svg |
| skin | string | tanned | Possible values: tanned, yellow, pale, light, brown, darkBrown, black |
| top | string | shortWaved | Possible values: dreads01, dreads02, frizzle, shaggyMullet, shaggy, shortCurly, shortFlat, shortRound, sides, shortWaved, theCaesarAndSidePart, theCaesar, bigHair, bob, bun, curly, curvy, dreads, frida, froAndBand, fro, longButNotTooLong, miaWallace, shavedSides, straightAndStrand, straight01, straight02, eyepatch, turban, hijab, hat, winterHat01, winterHat02, winterHat03, winterHat04 |
| hairColor | string | auburn | Possible values: auburn, black, blonde, blondeGolden, brown, brownDark, pastelPink, platinum, red, silverGray |
| hatColor | string | blue02 | Possible values: black, blue01, blue02, blue03, gray01, gray02, heather, pastelBlue, pastelGreen, pastelOrange, pastelRed, pastelYellow, pink, red, white |
| accessories | string | none | Possible values: none, kurt, prescription01, prescription02, round, sunglasses, wayfarers |
| accessoriesColor | string | black | Possible values: black, blue01, blue02, blue03, gray01, gray02, heather, pastelBlue, pastelGreen, pastelOrange, pastelRed, pastelYellow, pink, red, white |
| facialHair | string | none | Possible values: none, beardLight, beardMagestic, beardMedium, moustaceFancy, moustacheMagnum |
| facialHairColor | string | auburn | Possible values: auburn, black, blonde, blondeGolden, brown, brownDark, pastelPink, platinum, red, silverGray |
| clothing | string | shirtCrewNeck | Possible values: blazerAndShirt, blazerAndSweater, collarAndSweater, graphicShirt, hoodie, overall, shirtCrewNeck, shirtScoopNeck, shirtVNeck |
| clothingGraphic | string | pizza | Possible values: skrullOutline, skrull, resist, pizza, hola, diamond, deer, dumbia, bear, bat |
| clothingColor | string | black | Possible values: black, blue01, blue02, blue03, gray01, gray02, heather, pastelBlue, pastelGreen, pastelOrange, pastelRed, pastelYellow, pink, red, white
Security Score
Audited on Sep 23, 2025
