DiceBear 10.1 - Release Notes #532
FlorianKoerner
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
With version 10.0 we promised that DiceBear wouldn't stop at JavaScript and PHP - and that further language implementations were on the way. Version 10.1 makes good on that promise: DiceBear now speaks Python 🐍
This release also brings a batch of cross-language parity fixes that landed in the 10.0.1 and 10.0.2 patches, so that every official implementation produces truly byte-identical output for the same style and options.
🐍 Python Support
DiceBear is now available for Python (3.10+)! The API is identical to the JavaScript and PHP libraries, and the same seed and style definition produce byte-identical SVGs across all three implementations.
You need two packages: the core library
dicebear-coreand the avatar style definitionsdicebear-styles.Example:
🤝 Cross-Language Parity
A big part of this release is making sure JavaScript, PHP, and Python agree down to the last byte. The following fixes (from the 10.0.1 and 10.0.2 patches) are now part of 10.1:
Consistent SVG number rounding: Numeric values in rendered SVGs are now rounded to at most 5 decimal places everywhere. Previously, fractional or very small/large values — a fractional
borderRadiusortranslateX, component transforms, gradient stop offsets — could be stringified differently between languages (scientific notation, differing precision). Avatars built from whole-number options were unaffected.PHP rounding parity:
Prng::floatnow rounds halves toward +Infinity (matching JavaScript'sMath.round) instead of PHP's nativeround(). The two diverged for negative values landing exactly on a.5boundary, so a PHP-rendered avatar could differ from the JavaScript one by0.0001in a transform or color angle for certain seeds.Multibyte initials in PHP: Initials are now derived correctly from seeds containing multibyte letters such as
üorô. A missing Unicode flag previously corrupted those letters — e.g.überandcôtéproduced wrong or empty initials instead ofÜB/CÔ.Single-element range arrays: Range options (
scale,borderRadius,rotate,translateX/translateY, per-color angle/fill-stops) given as a single-element array[n]are now treated as the fixed valuen, and an empty array[]falls back to the option's default. Previously JavaScript emittedNaNwhile PHP dropped[n]to the default. All three now agree.Schema upper bound: The bundled
@dicebear/schemawas bumped to1.1.0, adding an upper bound of1000000to the canvas and componentwidth/height. This prevents the language ports' number-to-string formatting from diverging at extreme values. Official styles use ~100, so no real avatar is affected.💻 CLI Fix
dicebear --versionanddicebear --helpno longer fail by trying to read a file named--version/--help. The definition path is now resolved via the argument parser, so flags before the path are handled correctly — e.g.dicebear --json my-style.jsonanddicebear --count 2 my-style.json.Beta Was this translation helpful? Give feedback.
All reactions