WebGL shaders that you can plug and play into your project.
Live shaders for product UI: avatars from any name, email or user ID, presence cursors with the avatar built in, and outlines for your own buttons and cards. Everything on a page shares one WebGL context. There's a PNG export for places a shader can't run, and a React entry.
See every effect, and try your own seeds, at shaders.craftedstudios.co.
npm i @craftedstudios/shaders
No dependencies. React is optional.
Give each avatar a seed. The seed decides the effect, the colors and the layout, so the same person always gets the same avatar.
React:
import { Avatar } from '@craftedstudios/shaders/react'; <Avatar seed={user.id} size={40} />
Web component:
import { defineAvatarElement } from '@craftedstudios/shaders'; defineAvatarElement();
<crafted-avatar seed="ada@northwind.co" size="40"></crafted-avatar>
Plain JavaScript:
import { avatar } from '@craftedstudios/shaders'; const a = avatar(el, { seed: 'ada@northwind.co', size: 40 }); a.update({ effect: 'thermal' }); a.destroy();
Every option except seed is optional. The same names work as React props, web component attributes (ring-color for ringColor) and plain JavaScript options.
seed
ring-color
ringColor
size
32
effect
auto
linear
radial
thermal
topography
plasma
colors
motion
still
interaction
goo
follow
repel
distort
pulse
orbit
turbulence
none
speed
1
shape
circle
squircle
square
ring
0
label
grain, distortion, scale, stretch and thickness fine-tune the look. The Lab shows what each one does.
grain
distortion
scale
stretch
thickness
The same seed gives the same avatar everywhere: on the server, in the browser and in a PNG. Nothing is uploaded, fetched or stored.
Use something stable. An email works until someone changes it; a user ID never does.
For email, native apps and social images, export a PNG. It takes the same options and comes out up to 2048px square.
import { toBlob, toDataURL } from '@craftedstudios/shaders'; const png = await toBlob('ada@northwind.co', { size: 1024 }); const src = await toDataURL('ada@northwind.co', { effect: 'radial' });