glowmoji

why use a plain grey circle when you can have a glowing little guy?

install
npm install glowmoji

no build step? no problem. drop a script tag and go:

html
<script src="https://unpkg.com/glowmoji/dist/glowmoji.global.js"></script>
<body>
  <div id="avatar"></div>
  <script>
    glowmoji.mount(document.getElementById('avatar'), { name: 'Alice' });
  </script>
</body>

usage

vanilla js

works anywhere — no framework required.

ts
import { mount } from 'glowmoji';

// sets innerHTML, auto-blinks, click-to-blink
const stop = mount(document.getElementById('avatar'), { name: 'Alice' });

// with a click animation
const stop = mount(el, { name: 'Bob' }, { onClickAnimation: 'hurt' });

// or manually for more control
import { glowmoji, autoBlink, blink } from 'glowmoji';
const { svg } = glowmoji({ name: 'Alice', transparent: true });
el.innerHTML = svg;
el.addEventListener('click', () => blink(el));
const stop = autoBlink(el);

click animations

pass onClickAnimation to mount() or the React component to change what happens on click.

ts
import { mount, hurt, kiss } from 'glowmoji';

// via mount
mount(el, { name: 'Alice' }, { onClickAnimation: 'kiss' });

// or call directly
hurt(container);
kiss(container);

react

import from the /react subpath for a typed component.

tsx
import { Glowmoji } from 'glowmoji/react';

// basic
<Glowmoji name="Alice" />

// with options
<Glowmoji name="Alice" size={48} shape="circle" color="#a78bfa" />

// with click animation
<Glowmoji name="Alice" onClickAnimation="hurt" />

// render as <img> instead of inline SVG
<Glowmoji name="Alice" asImg />

requires React 17+. works with whatever version your project already has.


playground

type a name, pick a color, change the shape. click any avatar to see the animation.

click animation
sizes
name variations

api

options

proptypedefaultdescription
namestringseed for the avatar. same name = same result
sizenumber64width & height in px
shapeShaperoundedsquare · rounded · circle
colorstringhex color override. glow is derived automatically
transparentbooleanfalseskip the dark bg — use on light pages

click animations

valuedescription
blinkdefault — a quick blink
hurtX eyes, round open mouth, slight squish
kissone eye winks, ε pucker lips, floating heart

return value

ts
interface GlowmojiResult {
  svg:     string;   // raw SVG markup
  dataUri: string;   // data URI for <img src>
  palette: Palette;  // colors that were used
}

react props

proptypedescription
asImgbooleanrender as <img> instead of inline SVG
onClickAnimationClickAnimationblink · hurt · kiss
classNamestringclass on the wrapper element
styleCSSPropertiesinline styles on the wrapper