Avatars
A deterministic mesh-gradient avatar for any seed, rendered on a <canvas>, or a crisp ordered dither of the same palette via pattern. The same seed always yields the same avatar, with no stored images and no network. Self-contained: the engine is bundled in.
Installation
Install with your package manager of choice. React 18 or newer is the only peer dependency.
Usage
Import the component and give it a seed. That's it: the same seed always renders the same gradient, so a user id or email is a stable avatar with nothing to store.
Props
Sizes & shapes
size scales the avatar; radius reshapes it. It defaults to a full circle. Pass a number for a rounded square or 0 for a hard square.
Patterns
pattern switches the render engine. mesh (the default) is the signature soft gradient; dither is an ordered dither of the same palette, a crisp retro look with no blur that ramps along a fixed diagonal, so a set of dithers reads as one family. Both are deterministic from the seed.
Colors & P3
By default the palette is derived from the seed via color-harmony rules. Pass colors to use your own palette instead, brand colors, a product theme, anything. The seed still drives the layout (and rotates which color leads), so every seed stays unique while staying on-brand. Hex in, # optional.
Set p3 to render in the wide-gamut Display P3 color space. On capable screens the palette reads noticeably more vivid; everywhere else it maps back to the same sRGB color, so it's safe to leave on.
Engine helpers
The bundled engine is re-exported so you can render gradients outside React: to a data URL for an <img>, a Blob for the clipboard, or a full-resolution download.
Every helper takes an options object. Pass displaySize when you draw larger than you display, for example at 256 px for a 32 px avatar: it is the on-screen size in CSS pixels, and it sets the level of detail. It defaults to the size you draw at.
Types are exported too: GradientPalette, Harmony, RenderOptions, and ExportOptions.
License
Free to use under the MIT license. Use it anywhere, commercial or not, no attribution required.