DiceBear.Core
10.7.0-rc.1
dotnet add package DiceBear.Core --version 10.7.0-rc.1
NuGet\Install-Package DiceBear.Core -Version 10.7.0-rc.1
<PackageReference Include="DiceBear.Core" Version="10.7.0-rc.1" />
<PackageVersion Include="DiceBear.Core" Version="10.7.0-rc.1" />
<PackageReference Include="DiceBear.Core" />
paket add DiceBear.Core --version 10.7.0-rc.1
#r "nuget: DiceBear.Core, 10.7.0-rc.1"
#:package DiceBear.Core@10.7.0-rc.1
#addin nuget:?package=DiceBear.Core&version=10.7.0-rc.1&prerelease
#tool nuget:?package=DiceBear.Core&version=10.7.0-rc.1&prerelease
<h1><img src="https://www.dicebear.com/logo-readme.svg" width="28" /> DiceBear Core (C#)</h1>
.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.
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 | Versions 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. |
-
.NETStandard 2.0
- DiceBear.Schema (>= 1.5.0)
- JsonSchema.Net (>= 9.4.0 && < 10.0.0)
-
net8.0
- DiceBear.Schema (>= 1.5.0)
- JsonSchema.Net (>= 9.4.0 && < 10.0.0)
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 |