Gradient Avatar Generator
Enter a username to generate an avatar
Featured Examples
Usage Guide
Basic Usage
Get started with a simple username:
https://xvatar.vercel.app/api/avatar/xeven777
With Initials
Add text to your avatar:
https://xvatar.vercel.app/api/avatar/username.svg?text=GR
Custom Shape
Change the roundness:
https://xvatar.vercel.app/api/avatar/newusername?rounded=20
Custom Size
Change the dimensions:
https://xvatar.vercel.app/api/avatar/username?size=200
User Logo
Add a user icon:
https://xvatar.vercel.app/api/avatar/diddy?userLogo=true
User Logo
Add a user icon:
https://xvatar.vercel.app/api/avatar/coolest.svg?userLogo=true
Using the Sdk
Installation
npm install xvatar-sdk
yarn add xvatar-sdk
pnpm add xvatar-sdk
Basic Usage
import { generateAvatar } from "xvatar-sdk";
// Generate a simple avatar
const avatarUrl = generateAvatar({
username: "johndoe"
});
Advanced Options
// All available options
const customAvatar = generateAvatar({
username: "scarlett", // Required: Seed for the avatar
size: 300, // Optional: Size in pixels (default: 140)
format: "svg", // Optional: 'png' or 'svg' (default: 'png')
rounded: 80, // Optional: Corner roundness (default: 70)
userLogo: true, // Optional: Add user icon (default: false)
text: "JD" // Optional: Add text/initials (SVG only)
});
Examples
Professional Avatar:
generateAvatar({
username: "ceo@company.com",
size: 500,
rounded: 100,
text: "CEO"
})
Social Media Profile:
generateAvatar({
username: "cool_user_123",
size: 200,
format: "svg",
userLogo: true // Add user icon
})