DiceBear.Core 10.7.0-rc.1

This is a prerelease version of DiceBear.Core.
dotnet add package DiceBear.Core --version 10.7.0-rc.1
                    
NuGet\Install-Package DiceBear.Core -Version 10.7.0-rc.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DiceBear.Core" Version="10.7.0-rc.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DiceBear.Core" Version="10.7.0-rc.1" />
                    
Directory.Packages.props
<PackageReference Include="DiceBear.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DiceBear.Core --version 10.7.0-rc.1
                    
#r "nuget: DiceBear.Core, 10.7.0-rc.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DiceBear.Core@10.7.0-rc.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DiceBear.Core&version=10.7.0-rc.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=DiceBear.Core&version=10.7.0-rc.1&prerelease
                    
Install as a Cake Tool

<h1><img src="https://www.dicebear.com/logo-readme.svg" width="28" /> DiceBear Core (C#)</h1>

stars license

.NET implementation of the DiceBear avatar library. Generates deterministic SVG avatars from style definitions and a seed string.

DiceBear is available for multiple languages. All implementations share the same PRNG and rendering pipeline, producing identical SVG output for the same seed, style, and options, regardless of the language used.

Playground | Documentation

Installation

dotnet add package DiceBear.Core
dotnet add package DiceBear.Styles

Targets netstandard2.0 and net8.0, so it runs on .NET 8 and newer, on Godot 4.2+ with .NET, on Unity, and on .NET Framework 4.6.1+.

Usage

using System.Text.Json.Nodes;
using DiceBear;

var style = Style.Parse(Styles.Lorelei);

var avatar = new Avatar(style, new JsonObject
{
    ["seed"] = "John",
    ["size"] = 128,
});

avatar.ToSvg();      // SVG string
avatar.ToDataUri();  // data:image/svg+xml;charset=utf-8,...

Style.Parse takes the definition as text, so a style outside the styles package works the same way: read the JSON from a file or a request and hand it over.

Reusing a style

Validating and decomposing a definition is the expensive part, so build the Style once and render as many avatars from it as you need.

var style = Style.Parse(Styles.Lorelei);

var alice = new Avatar(style, new JsonObject { ["seed"] = "Alice" });
var bob = new Avatar(style, new JsonObject { ["seed"] = "Bob" });

In Godot

Godot 4 renders SVG through Image.LoadSvgFromString, so an avatar becomes a texture without any extra dependency.

Godot 4 renders SVG through Image.LoadSvgFromString, so an avatar becomes a texture without any extra dependency.

using Godot;
using System.Text.Json.Nodes;
using DiceBear;

var style = Style.Parse(Styles.Lorelei);

var svg = new Avatar(style, new JsonObject { ["seed"] = "John" }).ToSvg();

var image = new Image();
image.LoadSvgFromString(svg);

var texture = ImageTexture.CreateFromImage(image);

To keep the export small, skip DiceBear.Styles and ship only the definitions you use as project assets. FileAccess.Open("res://…") reads them in an exported game as well.

Errors

Invalid input throws instead of returning a result type, which is what a .NET caller expects. The other ports name these types ValidationError after their own conventions.

Exception Thrown when
StyleValidationException A style definition violates the schema
OptionsValidationException The options violate the schema
CircularColorReferenceException A color in the definition references itself

Both validation exceptions carry the individual field failures in Details.

Sponsors

Advertisement: Many thanks to our sponsors who provide us with free or discounted products.

<a href="https://bunny.net/" target="_blank" rel="noopener noreferrer"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://www.dicebear.com/sponsors/bunny-light.svg"> <source media="(prefers-color-scheme: light)" srcset="https://www.dicebear.com/sponsors/bunny-dark.svg"> <img alt="bunny.net" src="https://www.dicebear.com/sponsors/bunny-dark.svg" height="64"> </picture> </a>

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.7.0-rc.1 48 8/22/2026