dicebear-schema 1.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Florian Körner
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dicebear-schema
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: JSON Schema definitions for DiceBear avatar styles and options
|
|
5
|
+
Project-URL: Homepage, https://www.dicebear.com
|
|
6
|
+
Project-URL: Repository, https://github.com/dicebear/schema
|
|
7
|
+
Project-URL: Issues, https://github.com/dicebear/schema/issues
|
|
8
|
+
Author-email: Florian Körner <contact@florian-koerner.com>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: avatar,dicebear,json-schema,schema
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# @dicebear/schema
|
|
24
|
+
|
|
25
|
+
JSON Schema definitions for [DiceBear](https://dicebear.com) avatar styles and options.
|
|
26
|
+
|
|
27
|
+
## Schemas
|
|
28
|
+
|
|
29
|
+
This package exports two JSON Schemas (Draft 07):
|
|
30
|
+
|
|
31
|
+
### `definition.json`
|
|
32
|
+
|
|
33
|
+
Validates avatar style definitions — the files that describe how a DiceBear avatar style is structured. A definition includes:
|
|
34
|
+
|
|
35
|
+
- **`canvas`** _(required)_ — The SVG canvas dimensions and root element tree
|
|
36
|
+
- **`components`** — Named, reusable SVG components with variants. At render time, a PRNG selects one variant per component. Components can also be declared as aliases of another component via `extends`, producing an independently-randomized instance.
|
|
37
|
+
- **`colors`** — Named color palettes. Colors can define constraints such as `notEqualTo` (must differ from another color) or `contrastTo` (picks the highest-contrast value).
|
|
38
|
+
- **`attributes`** — Global SVG attributes applied to the root `<svg>` element
|
|
39
|
+
- **`meta`** — License, creator, and source metadata
|
|
40
|
+
|
|
41
|
+
Only a safe subset of SVG elements and attributes is permitted. Event handlers, external URL references, and CSS injection patterns are explicitly blocked.
|
|
42
|
+
|
|
43
|
+
#### Additional Documentation
|
|
44
|
+
|
|
45
|
+
https://www.dicebear.com/specification/definition-schema/
|
|
46
|
+
|
|
47
|
+
### `options.json`
|
|
48
|
+
|
|
49
|
+
Validates the options object passed by users when generating an avatar. Supported properties include:
|
|
50
|
+
|
|
51
|
+
| Property | Type | Description |
|
|
52
|
+
| ----------------- | ------------------------------ | ------------------------------------------------------------- |
|
|
53
|
+
| `seed` | `string` | PRNG seed for reproducible avatars |
|
|
54
|
+
| `size` | `integer` | Output size in pixels (1 to 4096) |
|
|
55
|
+
| `title` | `string` | Accessible title rendered as `<title>` and `aria-label` |
|
|
56
|
+
| `flip` | `string \| array` | Mirror direction: `none`, `horizontal`, `vertical`, or `both` |
|
|
57
|
+
| `scale` | `number \| [min, max]` | Scaling factor (0 to 10, 1 = original size) |
|
|
58
|
+
| `rotate` | `number \| [min, max]` | Rotation in degrees (−360 to 360) |
|
|
59
|
+
| `translateX` | `number \| [min, max]` | Horizontal offset (−1000 to 1000) |
|
|
60
|
+
| `translateY` | `number \| [min, max]` | Vertical offset (−1000 to 1000) |
|
|
61
|
+
| `borderRadius` | `number \| [min, max]` | Corner radius (0 = sharp, 50 = circle) |
|
|
62
|
+
| `idRandomization` | `boolean` | SVG ID randomization to avoid conflicts |
|
|
63
|
+
| `fontFamily` | `string \| array` | Font family for text rendering |
|
|
64
|
+
| `fontWeight` | `integer \| array` | Font weight (1 to 1000) |
|
|
65
|
+
| `*Probability` | `number` | Component display probability (0 to 100) |
|
|
66
|
+
| `*Variant` | `string \| string[] \| object` | Component variant filter and weights |
|
|
67
|
+
| `*Color` | `string \| array` | Hex colors |
|
|
68
|
+
| `*ColorFill` | `string \| array` | Color fill: `solid`, `linear`, or `radial` |
|
|
69
|
+
| `*ColorFillStops` | `integer \| [min, max]` | Gradient color stops (min 2) |
|
|
70
|
+
| `*ColorAngle` | `number \| [min, max]` | Gradient angle (−360 to 360) |
|
|
71
|
+
|
|
72
|
+
When an option accepts an array, the PRNG either picks from the list (for discrete values) or picks a value within the range (for numeric min/max pairs).
|
|
73
|
+
|
|
74
|
+
## Usage
|
|
75
|
+
|
|
76
|
+
**JavaScript**
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npm install @dicebear/schema
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
```js
|
|
83
|
+
import definitionSchema from "@dicebear/schema/definition.json" with { type: "json" };
|
|
84
|
+
import optionsSchema from "@dicebear/schema/options.json" with { type: "json" };
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**PHP**
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
composer require dicebear/schema
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
```php
|
|
94
|
+
$basePath = \Composer\InstalledVersions::getInstallPath('dicebear/schema');
|
|
95
|
+
|
|
96
|
+
$definition = json_decode(file_get_contents($basePath . '/src/definition.json'), true);
|
|
97
|
+
$options = json_decode(file_get_contents($basePath . '/src/options.json'), true);
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Python**
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
pip install dicebear-schema
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
import json
|
|
108
|
+
from importlib.resources import files
|
|
109
|
+
|
|
110
|
+
definition = json.loads(files("dicebear_schema").joinpath("definition.json").read_text("utf-8"))
|
|
111
|
+
options = json.loads(files("dicebear_schema").joinpath("options.json").read_text("utf-8"))
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**CDN**
|
|
115
|
+
|
|
116
|
+
The schemas are available directly via CDN — no installation required. We recommend using a specific version to ensure stability:
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
https://cdn.hopjs.net/npm/@dicebear/schema@1.1.0/dist/definition.min.json
|
|
120
|
+
https://cdn.hopjs.net/npm/@dicebear/schema@1.1.0/dist/options.min.json
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Contributing
|
|
124
|
+
|
|
125
|
+
See [CONTRIBUTING.md](https://github.com/dicebear/schema/blob/main/CONTRIBUTING.md) for local development, testing,
|
|
126
|
+
and the release process.
|
|
127
|
+
|
|
128
|
+
## Sponsors
|
|
129
|
+
|
|
130
|
+
Advertisement: Many thanks to our sponsors who provide us with free or discounted products.
|
|
131
|
+
|
|
132
|
+
<a href="https://bunny.net/" target="_blank" rel="noopener noreferrer">
|
|
133
|
+
<picture>
|
|
134
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://www.dicebear.com/sponsors/bunny-light.svg">
|
|
135
|
+
<source media="(prefers-color-scheme: light)" srcset="https://www.dicebear.com/sponsors/bunny-dark.svg">
|
|
136
|
+
<img alt="bunny.net" src="https://www.dicebear.com/sponsors/bunny-dark.svg" height="64">
|
|
137
|
+
</picture>
|
|
138
|
+
</a>
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# @dicebear/schema
|
|
2
|
+
|
|
3
|
+
JSON Schema definitions for [DiceBear](https://dicebear.com) avatar styles and options.
|
|
4
|
+
|
|
5
|
+
## Schemas
|
|
6
|
+
|
|
7
|
+
This package exports two JSON Schemas (Draft 07):
|
|
8
|
+
|
|
9
|
+
### `definition.json`
|
|
10
|
+
|
|
11
|
+
Validates avatar style definitions — the files that describe how a DiceBear avatar style is structured. A definition includes:
|
|
12
|
+
|
|
13
|
+
- **`canvas`** _(required)_ — The SVG canvas dimensions and root element tree
|
|
14
|
+
- **`components`** — Named, reusable SVG components with variants. At render time, a PRNG selects one variant per component. Components can also be declared as aliases of another component via `extends`, producing an independently-randomized instance.
|
|
15
|
+
- **`colors`** — Named color palettes. Colors can define constraints such as `notEqualTo` (must differ from another color) or `contrastTo` (picks the highest-contrast value).
|
|
16
|
+
- **`attributes`** — Global SVG attributes applied to the root `<svg>` element
|
|
17
|
+
- **`meta`** — License, creator, and source metadata
|
|
18
|
+
|
|
19
|
+
Only a safe subset of SVG elements and attributes is permitted. Event handlers, external URL references, and CSS injection patterns are explicitly blocked.
|
|
20
|
+
|
|
21
|
+
#### Additional Documentation
|
|
22
|
+
|
|
23
|
+
https://www.dicebear.com/specification/definition-schema/
|
|
24
|
+
|
|
25
|
+
### `options.json`
|
|
26
|
+
|
|
27
|
+
Validates the options object passed by users when generating an avatar. Supported properties include:
|
|
28
|
+
|
|
29
|
+
| Property | Type | Description |
|
|
30
|
+
| ----------------- | ------------------------------ | ------------------------------------------------------------- |
|
|
31
|
+
| `seed` | `string` | PRNG seed for reproducible avatars |
|
|
32
|
+
| `size` | `integer` | Output size in pixels (1 to 4096) |
|
|
33
|
+
| `title` | `string` | Accessible title rendered as `<title>` and `aria-label` |
|
|
34
|
+
| `flip` | `string \| array` | Mirror direction: `none`, `horizontal`, `vertical`, or `both` |
|
|
35
|
+
| `scale` | `number \| [min, max]` | Scaling factor (0 to 10, 1 = original size) |
|
|
36
|
+
| `rotate` | `number \| [min, max]` | Rotation in degrees (−360 to 360) |
|
|
37
|
+
| `translateX` | `number \| [min, max]` | Horizontal offset (−1000 to 1000) |
|
|
38
|
+
| `translateY` | `number \| [min, max]` | Vertical offset (−1000 to 1000) |
|
|
39
|
+
| `borderRadius` | `number \| [min, max]` | Corner radius (0 = sharp, 50 = circle) |
|
|
40
|
+
| `idRandomization` | `boolean` | SVG ID randomization to avoid conflicts |
|
|
41
|
+
| `fontFamily` | `string \| array` | Font family for text rendering |
|
|
42
|
+
| `fontWeight` | `integer \| array` | Font weight (1 to 1000) |
|
|
43
|
+
| `*Probability` | `number` | Component display probability (0 to 100) |
|
|
44
|
+
| `*Variant` | `string \| string[] \| object` | Component variant filter and weights |
|
|
45
|
+
| `*Color` | `string \| array` | Hex colors |
|
|
46
|
+
| `*ColorFill` | `string \| array` | Color fill: `solid`, `linear`, or `radial` |
|
|
47
|
+
| `*ColorFillStops` | `integer \| [min, max]` | Gradient color stops (min 2) |
|
|
48
|
+
| `*ColorAngle` | `number \| [min, max]` | Gradient angle (−360 to 360) |
|
|
49
|
+
|
|
50
|
+
When an option accepts an array, the PRNG either picks from the list (for discrete values) or picks a value within the range (for numeric min/max pairs).
|
|
51
|
+
|
|
52
|
+
## Usage
|
|
53
|
+
|
|
54
|
+
**JavaScript**
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm install @dicebear/schema
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
```js
|
|
61
|
+
import definitionSchema from "@dicebear/schema/definition.json" with { type: "json" };
|
|
62
|
+
import optionsSchema from "@dicebear/schema/options.json" with { type: "json" };
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**PHP**
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
composer require dicebear/schema
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
```php
|
|
72
|
+
$basePath = \Composer\InstalledVersions::getInstallPath('dicebear/schema');
|
|
73
|
+
|
|
74
|
+
$definition = json_decode(file_get_contents($basePath . '/src/definition.json'), true);
|
|
75
|
+
$options = json_decode(file_get_contents($basePath . '/src/options.json'), true);
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Python**
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pip install dicebear-schema
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
import json
|
|
86
|
+
from importlib.resources import files
|
|
87
|
+
|
|
88
|
+
definition = json.loads(files("dicebear_schema").joinpath("definition.json").read_text("utf-8"))
|
|
89
|
+
options = json.loads(files("dicebear_schema").joinpath("options.json").read_text("utf-8"))
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**CDN**
|
|
93
|
+
|
|
94
|
+
The schemas are available directly via CDN — no installation required. We recommend using a specific version to ensure stability:
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
https://cdn.hopjs.net/npm/@dicebear/schema@1.1.0/dist/definition.min.json
|
|
98
|
+
https://cdn.hopjs.net/npm/@dicebear/schema@1.1.0/dist/options.min.json
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Contributing
|
|
102
|
+
|
|
103
|
+
See [CONTRIBUTING.md](https://github.com/dicebear/schema/blob/main/CONTRIBUTING.md) for local development, testing,
|
|
104
|
+
and the release process.
|
|
105
|
+
|
|
106
|
+
## Sponsors
|
|
107
|
+
|
|
108
|
+
Advertisement: Many thanks to our sponsors who provide us with free or discounted products.
|
|
109
|
+
|
|
110
|
+
<a href="https://bunny.net/" target="_blank" rel="noopener noreferrer">
|
|
111
|
+
<picture>
|
|
112
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://www.dicebear.com/sponsors/bunny-light.svg">
|
|
113
|
+
<source media="(prefers-color-scheme: light)" srcset="https://www.dicebear.com/sponsors/bunny-dark.svg">
|
|
114
|
+
<img alt="bunny.net" src="https://www.dicebear.com/sponsors/bunny-dark.svg" height="64">
|
|
115
|
+
</picture>
|
|
116
|
+
</a>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
# hatchling >= 1.27 is required for the PEP 639 `license = "MIT"` SPDX string.
|
|
3
|
+
requires = ["hatchling>=1.27"]
|
|
4
|
+
build-backend = "hatchling.build"
|
|
5
|
+
|
|
6
|
+
[project]
|
|
7
|
+
name = "dicebear-schema"
|
|
8
|
+
version = "1.1.0"
|
|
9
|
+
description = "JSON Schema definitions for DiceBear avatar styles and options"
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
license = "MIT"
|
|
13
|
+
license-files = ["LICENSE"]
|
|
14
|
+
authors = [{ name = "Florian Körner", email = "contact@florian-koerner.com" }]
|
|
15
|
+
keywords = ["dicebear", "avatar", "schema", "json-schema"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
19
|
+
"Programming Language :: Python :: 3.10",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Programming Language :: Python :: 3.13",
|
|
23
|
+
"Programming Language :: Python :: 3.14",
|
|
24
|
+
"Topic :: Software Development :: Libraries",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
# Data-only distribution: no runtime dependencies and no Python code. The two
|
|
28
|
+
# draft-07 schemas ship as JSON resources under the `dicebear_schema` import
|
|
29
|
+
# name and are read by the consumer via the standard library, mirroring how
|
|
30
|
+
# `@dicebear/schema` (npm) and `dicebear/schema` (Composer) ship pure data:
|
|
31
|
+
#
|
|
32
|
+
# import json
|
|
33
|
+
# from importlib.resources import files
|
|
34
|
+
#
|
|
35
|
+
# definition = json.loads(
|
|
36
|
+
# files("dicebear_schema").joinpath("definition.json").read_text("utf-8")
|
|
37
|
+
# )
|
|
38
|
+
|
|
39
|
+
[project.urls]
|
|
40
|
+
Homepage = "https://www.dicebear.com"
|
|
41
|
+
Repository = "https://github.com/dicebear/schema"
|
|
42
|
+
Issues = "https://github.com/dicebear/schema/issues"
|
|
43
|
+
|
|
44
|
+
# Ship the committed `src/*.json` schemas as the `dicebear_schema` namespace
|
|
45
|
+
# package (a directory of JSON resources, no `__init__.py`). `bypass-selection`
|
|
46
|
+
# tells hatchling there are no Python packages to discover — by design. Using
|
|
47
|
+
# `src/` (not the generated, gitignored `dist/`, which carries an injected `$id`)
|
|
48
|
+
# keeps the package in sync with the PHP usage and needs no build step before
|
|
49
|
+
# packaging.
|
|
50
|
+
[tool.hatch.build.targets.wheel]
|
|
51
|
+
bypass-selection = true
|
|
52
|
+
force-include = { "src" = "dicebear_schema" }
|
|
53
|
+
|
|
54
|
+
[tool.hatch.build.targets.sdist]
|
|
55
|
+
include = ["src/*.json", "README.md", "LICENSE", "pyproject.toml"]
|