SVG Avatarify
A simple but highly customisable API endpoint to provide a SVG for the name or initials which shall serve as an avatar.
How to use
An SVG image is returned for each request to https://svg-avatarify.vercel.app/api/generator. The following customisation options are available:
option | description | example code | demo |
---|---|---|---|
name |
Name of the user -> first & last name's initials are extracted | https://svg-avatarify.vercel.app/api/generator?name=SVG%20Avatarify | |
initials |
Initials passed directly. When present, name query parameter is ignored |
https://svg-avatarify.vercel.app/api/generator?initials=SA | |
background |
Background of the image. Pass a valid hex color value without # . If absent a random color out of a list is chosen |
https://svg-avatarify.vercel.app/api/generator?name=SVG%20Avatarify&background=567890 | |
color |
Color of the initials on the icon. Pass a valid hex color value without # . Default:fff |
https://svg-avatarify.vercel.app/api/generator?name=SVG%20Avatarify&color=333 | |
dim |
Dimensions of the image in pixels . Default:50 |
https://svg-avatarify.vercel.app/api/generator?name=SVG%20Avatarify&dim=40 | |
fontSize |
Font size of the text in pixels . Default:set by dim parameter = dim/2 |
https://svg-avatarify.vercel.app/api/generator?name=SVG%20Avatarify&fontSize=25 | |
case |
Case of the initials. Available: 0, 2 . If parameter is unused, the initials are captilaised. If case parameter is used, 0: no change , 2: lower case & if unknown value is passed default is 0 . |
https://svg-avatarify.vercel.app/api/generator?name=SVG%20Avatarify&case=2 | |
bold |
If set to true, produces a bold text with font-weight:700 . Default:false |
https://svg-avatarify.vercel.app/api/generator?name=SVG%20Avatarify&bold=true | |
rounded |
Number of pixels to round at corners. Default:0 |
https://svg-avatarify.vercel.app/api/generator?name=SVG%20Avatarify&rounded=10 | |
isRounded |
Set to true if circle icon is required. It is ignored when rounded parameter is present. Default: false |
https://svg-avatarify.vercel.app/api/generator?name=SVG%20Avatarify&isRounded=true |
Demo
https://svg-avatarify.vercel.app/api/generator?name=SVG%20Avatarify&dim=100
https://svg-avatarify.vercel.app/api/generator?name=SVG%20Avatarify&dim=100&rounded=10
https://svg-avatarify.vercel.app/api/generator?name=SVG%20Avatarify&dim=100&isRounded=true&bold=true
https://svg-avatarify.vercel.app/api/generator?name=SVG%20Avatarify&dim=100&isRounded=true&background=fe2&color=333
List of colors present - which shall result from random