Documentation

Everything to integrate Tronche into your projects

Installation

Shell
npm install tronche

Vanilla JS

Use the core generators directly — no framework required.

TypeScript
import { generateBeamSvg } from 'tronche'

const svg = generateBeamSvg('Clara Barton', ['#E07A5F', '#3D405B', '#81B29A', '#F4D06F', '#D8A47F'], {
  size: 120,
})
// svg: '<svg viewBox="0 0 36 36"...'

Nuxt Module

Add the module in your nuxt.config.ts :

JavaScript
export default defineNuxtConfig({
  modules: ['tronche/module'],
})

Components are auto-imported:

Vue
<template>
  <Avatar name="Maria Mitchell" variant="beam" />
</template>

Vue.js

Vue
<script setup>
import Avatar from 'tronche/vue/components/Avatar.vue'
</script>

<template>
  <Avatar name="Grace Hopper" :colors="[
    '#fb6900',
    '#f63700',
    '#004853',
  ]" />
</template>

Props

PropTypeDefaultDescription
namestringClara BartonName to generate the avatar
variantstringmarblemarble, beam, pixel, sunset, ring, bauhaus
sizenumber80Size in pixels
squarebooleanfalseSquare avatar
colorsstring[]palette5 hexadecimal colors
titlebooleanfalseTitle tag

REST API

Generate avatars remotely via our API.

GET/api/avatar/:name
ParameterTypeDefaultDescription
variantstringmarblemarble, beam, pixel, sunset, ring, bauhaus
sizenumber8016 to 512
squarebooleanfalsetrue or false
colorsstringComma-separated hex colors

Examples

Shell
curl "https://tronche.app/api/avatar/Clara%20Barton?variant=beam"
Shell
curl "https://tronche.app/api/avatar/test?size=200&square=true&colors=FF6B6B,4ECDC4,45B7D1"

Rate limiting

The free plan allows 100 requests per minute per IP. For higher volume, create an account and use an API key.

Variants

beam

beam

Expressive faces

pixel

pixel

8×8 pixel art

sunset

sunset

Color gradients

ring

ring

Concentric circles

bauhaus

bauhaus

Geometric shapes

marble

marble

Blurry organic shapes