A mobile / wasm port of Govatar
Generate funny avatars
For bare React Native projects, you must ensure that you have installed and configured the expo package before continuing.
bun add @kuzulabz/expo-govataryarn add @kuzulabz/expo-govatarnpm install @kuzulabz/expo-govatarimport { generateAvatar } from '@kuzulabz/govatar';
const username = 'KuzuLabz';
const base64String = await generateAvatar({username});
const imageUri = `data:image/png;base64,${base64String}`;Web requires these extra steps:
Add config.resolver.assetExts.push('wasm'); to your metro config file.
import { loadGovatarWeb, loadGovatarWebAsync } from '@kuzulabz/govatar';
// for example, in App.tsx
loadGovatarWeb();
// or asyncronously
await loadGovatarWebAsync();Generate an avatar
- username<optional>: A username or text
- gender<optional>: GenderType (default: normal)
- returns: base64 string
A selectable gender:
MALEFEMALE