Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@dicebear/collection

dicebear108.1kMIT9.2.2TypeScript support: included

Avatar style collection for DiceBear

dicebear

readme

DiceBear

With DiceBear you can create awesome avatars for your project in no time. Whether you are looking for abstract shapes or lovingly designed characters, you will find something suitable among our avatar styles. And no matter how and for what you want to use the avatars, DiceBear offers the right solution!

In addition to purely random avatars, you can also create deterministic avatars for user identities. With the built-in PRNG you create the same avatar over and over again based on a seed. But also individual avatars are possible! Just use the countless options that each avatar style provides.

And thanks to the JavaScript library, HTTP API, CLI, Figma plugin and Playground, your next avatar is always just a stone's throw away!

Playground | Documentation

changelog

Changelog

9.0.0

This release fixes a compatibility issue with Next.js caused by the converter that can convert generated SVG avatars to PNG and JPEG. As of this version, the converter is no longer part of the core library and must be installed separately.

Breaking changes

  • toDataUri is now synchronous and toDataUriSync has been removed accordingly.
  • toPng and toJpeg have been removed. These functions can still be used if the @dicebear/converter library is installed, which provides these two methods.

    Before:

    import { createAvatar } from '@dicebear/core';
    import { bottts } from '@dicebear/collection';
    
    const avatar = createAvatar(bottts);
    const png = await avatar.toPng();

    After:

    import { createAvatar } from '@dicebear/core';
    import { bottts } from '@dicebear/collection';
    import { toPng } from '@dicebear/converter';
    
    const avatar = createAvatar(bottts);
    const png = await toPng(avatar);

    See Documentation for more information.

  • toFile has been removed as the behaviour of the function cannot be kept consistent across the environments. Such a method must be implemented yourself.

  • toArrayBuffer for SVG format has been removed.

New features

  • toPng and toJpeg now support fonts as an option to set custom fonts. See Documentation for more information.

8.0.0

A major update with a small fix that changed the output of the avatars in some cases. As soon as a fix changes the output of the avatars, we release a major update to ensure that the avatars of a major version remain consistent. This update is backwards compatible and should not cause any issues.

A bug with random backgrounds has been fixed. These were not consistent between browsers due to their implementation. This problem has been fixed and the backgrounds should now be calculated identically in all browsers.

Further information on this bug can be found in this issue: https://github.com/dicebear/dicebear/issues/394