API reference / @evolu/common / Identicon / createIdenticon

Function: createIdenticon()

function createIdenticon(id, style): Identicon;

Defined in: packages/common/src/Identicon.ts:38

Creates a deterministic identicon SVG from an Id.

Works with any Id including branded IDs like OwnerId, etc.

Available styles:

  • "github" (default): 5x5 grid with horizontal mirroring (GitHub-style)
  • "quadrant": 2x2 grid with direct RGB color mapping from bytes
  • "gradient": Diagonal stripes with smooth color gradients
  • "sutnar": Three compositional variants with adaptive colors

Example

const svg = createIdenticon(id);
const quadrantStyle = createIdenticon(id, "quadrant");
const gradientStyle = createIdenticon(id, "gradient");
const sutnarStyle = createIdenticon(id, "sutnar");

// Works with branded IDs
const ownerSvg = createIdenticon(ownerId);

Parameters

ParameterTypeDefault value
idstring & Brand<"Id">undefined
styleIdenticonStyle"github"

Returns

Identicon

Was this page helpful?