@dicebear/schema 0.1.3 → 0.2.0
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.
- package/README.md +9 -0
- package/dist/definition.min.json +1 -1
- package/dist/options.min.json +1 -1
- package/package.json +1 -1
- package/src/options.json +18 -0
package/README.md
CHANGED
|
@@ -55,6 +55,15 @@ npm install @dicebear/schema
|
|
|
55
55
|
composer require dicebear/schema
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
+
**CDN**
|
|
59
|
+
|
|
60
|
+
The schemas are available directly via CDN — no installation required. We recommend using a specific version to ensure stability:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
https://cdn.hopjs.net/npm/@dicebear/schema@0.2.0/dist/definition.min.json
|
|
64
|
+
https://cdn.hopjs.net/npm/@dicebear/schema@0.2.0/dist/options.min.json
|
|
65
|
+
```
|
|
66
|
+
|
|
58
67
|
## Usage
|
|
59
68
|
|
|
60
69
|
**JavaScript**
|
package/dist/definition.min.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$id":"https://cdn.hopjs.net/npm/@dicebear/schema@0.1.3/dist/definition.min.json","$schema":"https://json-schema.org/draft/2020-12/schema","$defs":{"identifier":{"description":"A camelCase identifier starting with a lowercase letter. Used for component, variable, and color references.","type":"string","pattern":"^[a-z][a-zA-Z0-9]*$"},"variableName":{"description":"A camelCase identifier starting with a lowercase letter. Used for variable references.","type":"string","enum":["initial","initials","fontWeight","fontFamily"]},"colorAttribute":{"description":"A color value, either as a direct color string (named color, hex, rgb(a), hsl(a), hsb(a)) or as a reference to a named color defined in the `colors` section.","anyOf":[{"type":"string","anyOf":[{"pattern":"^[a-zA-Z]+$"},{"pattern":"^#([a-fA-F0-9]{3}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$"},{"pattern":"^rgba?\\(\\s*\\d+\\s*,\\s*\\d+\\s*,\\s*\\d+\\s*(,\\s*[0-1](\\.\\d+)?\\s*)?\\)$"},{"pattern":"^hsla?\\(\\s*\\d+\\s*,\\s*\\d+%\\s*,\\s*\\d+%\\s*(,\\s*[0-1](\\.\\d+)?\\s*)?\\)$"},{"pattern":"^hsba?\\(\\s*\\d+\\s*,\\s*\\d+%\\s*,\\s*\\d+%\\s*(,\\s*[0-1](\\.\\d+)?\\s*)?\\)$"}]},{"description":"A reference to a named color. At render time, the PRNG selects a color value from the referenced color.","type":"object","properties":{"type":{"type":"string","const":"color"},"value":{"description":"The name of the color to reference.","$ref":"#/$defs/identifier"}},"required":["type","value"],"additionalProperties":false}]},"safeUrl":{"description":"A URL restricted to HTTP and HTTPS protocols.","type":"string","pattern":"^https?://"},"paintAttribute":{"description":"A paint value for `fill` and `stroke` attributes. Accepts all color formats from `colorAttribute` as well as local SVG paint server references in the form `url(#id)`, e.g. for gradients or patterns.","anyOf":[{"$ref":"#/$defs/colorAttribute"},{"type":"string","pattern":"^url\\(#[a-zA-Z_][a-zA-Z0-9_.-]*\\)$"}]},"noExternalUrlRef":{"description":"A string that must not contain external URL references (e.g. `url(https://...)`) or CSS escape sequences (backslash). Local references such as `url(#id)` are permitted.","type":"string","not":{"anyOf":[{"pattern":"[uU][rR][lL]\\s*\\(\\s*[^#)]"},{"pattern":"\\\\"}]}},"noCssInjection":{"description":"A string that must not contain CSS injection patterns, including `@`-rules, `expression()`, `behavior:`, or `-moz-binding`.","type":"string","not":{"anyOf":[{"pattern":"@"},{"pattern":"[eE][xX][pP][rR][eE][sS][sS][iI][oO][nN]\\s*\\("},{"pattern":"[bB][eE][hH][aA][vV][iI][oO][rR]\\s*:"},{"pattern":"-[mM][oO][zZ]-[bB][iI][nN][dD][iI][nN][gG]"},{"pattern":"\\\\"}]}},"element":{"description":"An SVG node. Can be an actual SVG element (`element`), a raw text node (`text`), or a reference to a named component (`component`).","type":"object","properties":{"name":{"description":"The SVG tag name. Only a safe subset of SVG elements is permitted; dangerous elements such as `script`, `foreignObject`, or `a` are excluded.","type":"string","enum":["circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","g","image","line","linearGradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialGradient","rect","stop","style","svg","switch","symbol","text","textPath","title","tspan","use","view"]},"type":{"description":"The node type. `element` renders an SVG tag, `text` renders a raw text node, `component` inserts a named component by reference.","type":"string","enum":["element","text","component"]},"value":{"description":"The text content for `text` nodes, the component name for `component` nodes, or the CSS content for `style` elements. Can also be a variable reference object to dynamically inject a runtime value.","anyOf":[{"type":"string"},{"description":"A reference to a runtime variable. The variable value is resolved and injected at render time.","type":"object","properties":{"type":{"type":"string","const":"variable"},"value":{"description":"The name of the variable to reference.","$ref":"#/$defs/variableName"}},"required":["type","value"],"additionalProperties":false}]},"attributes":{"description":"SVG presentation attributes to apply to this element.","$ref":"#/$defs/attributes"},"children":{"description":"Nested child elements. Only valid for `element` and `text` nodes.","type":"array","items":{"$ref":"#/$defs/element"}}},"required":["type"],"additionalProperties":false,"allOf":[{"if":{"properties":{"type":{"const":"component"}},"required":["type"]},"then":{"required":["value"],"properties":{"value":{"$ref":"#/$defs/identifier"}},"not":{"required":["children"]}}},{"if":{"properties":{"type":{"const":"element"}},"required":["type"]},"then":{"required":["name"],"if":{"properties":{"name":{"const":"style"}}},"then":{"properties":{"value":{"allOf":[{"$ref":"#/$defs/noExternalUrlRef"},{"$ref":"#/$defs/noCssInjection"}]}}},"else":{"not":{"required":["value"]}}}}]},"attributes":{"description":"A map of allowed SVG presentation attributes. Only a safe subset is permitted; event handlers (e.g. `onclick`) and namespace attributes (e.g. `xlink:href`) are not allowed.","type":"object","properties":{"alignment-baseline":{"type":"string"},"amplitude":{"type":"string"},"azimuth":{"type":"string"},"baseFrequency":{"type":"string"},"baseline-shift":{"type":"string"},"bias":{"type":"string"},"class":{"description":"CSS class name(s). Only alphanumeric characters, underscores, hyphens, and spaces are allowed.","type":"string","pattern":"^[a-zA-Z0-9_ -]+$"},"clipPathUnits":{"type":"string"},"clip-path":{"description":"References a clip path. External URL references are not allowed.","$ref":"#/$defs/noExternalUrlRef"},"clip-rule":{"type":"string"},"color":{"$ref":"#/$defs/colorAttribute"},"color-interpolation":{"type":"string"},"color-interpolation-filters":{"type":"string"},"crossorigin":{"type":"string"},"cx":{"type":"string"},"cy":{"type":"string"},"d":{"type":"string"},"decoding":{"type":"string"},"diffuseConstant":{"type":"string"},"direction":{"type":"string"},"display":{"type":"string"},"divisor":{"type":"string"},"dx":{"type":"string"},"dy":{"type":"string"},"edgeMode":{"type":"string"},"elevation":{"type":"string"},"exponent":{"type":"string"},"fill":{"description":"The fill color or paint server reference for this element.","$ref":"#/$defs/paintAttribute"},"fill-opacity":{"type":"string"},"fill-rule":{"type":"string"},"filter":{"description":"References a filter effect. External URL references are not allowed.","$ref":"#/$defs/noExternalUrlRef"},"filterUnits":{"type":"string"},"flood-color":{"$ref":"#/$defs/colorAttribute"},"flood-opacity":{"type":"string"},"font-family":{"type":"string"},"font-size":{"type":"string"},"font-size-adjust":{"type":"string"},"font-style":{"type":"string"},"font-variant":{"type":"string"},"font-weight":{"type":"string"},"fx":{"type":"string"},"fy":{"type":"string"},"gradientTransform":{"type":"string"},"gradientUnits":{"type":"string"},"height":{"type":"string"},"href":{"description":"A hyperlink reference. Only local fragment references (`#id`) and safe data URIs (raster images) are allowed.","anyOf":[{"type":"string","pattern":"^#[a-zA-Z0-9-]+$"},{"type":"string","pattern":"^data:image/(png|gif|jpg|jpeg|webp|avif);base64,[a-zA-Z0-9+/=]+$"}]},"id":{"description":"A unique identifier for the element. Must start with a letter or underscore.","type":"string","pattern":"^[a-zA-Z_][a-zA-Z0-9_.-]*$"},"image-rendering":{"type":"string"},"in":{"type":"string"},"in2":{"type":"string"},"intercept":{"type":"string"},"k1":{"type":"string"},"k2":{"type":"string"},"k3":{"type":"string"},"k4":{"type":"string"},"kernelMatrix":{"type":"string"},"kernelUnitLength":{"type":"string"},"lang":{"type":"string"},"lengthAdjust":{"type":"string"},"letter-spacing":{"type":"string"},"lighting-color":{"$ref":"#/$defs/colorAttribute"},"marker-end":{"description":"References a marker to draw at the end of a path. External URL references are not allowed.","$ref":"#/$defs/noExternalUrlRef"},"marker-mid":{"description":"References a marker to draw at intermediate vertices of a path. External URL references are not allowed.","$ref":"#/$defs/noExternalUrlRef"},"marker-start":{"description":"References a marker to draw at the start of a path. External URL references are not allowed.","$ref":"#/$defs/noExternalUrlRef"},"markerHeight":{"type":"string"},"markerUnits":{"type":"string"},"markerWidth":{"type":"string"},"mask":{"description":"References a mask element. External URL references are not allowed.","$ref":"#/$defs/noExternalUrlRef"},"maskContentUnits":{"type":"string"},"maskUnits":{"type":"string"},"media":{"type":"string"},"method":{"type":"string"},"mode":{"type":"string"},"numOctaves":{"type":"string"},"offset":{"type":"string"},"opacity":{"type":"string"},"operator":{"type":"string"},"order":{"type":"string"},"orient":{"type":"string"},"overflow":{"type":"string"},"paint-order":{"type":"string"},"path":{"type":"string"},"pathLength":{"type":"string"},"patternContentUnits":{"type":"string"},"patternTransform":{"type":"string"},"patternUnits":{"type":"string"},"points":{"type":"string"},"preserveAlpha":{"type":"string"},"preserveAspectRatio":{"type":"string"},"primitiveUnits":{"type":"string"},"r":{"type":"string"},"radius":{"type":"string"},"refX":{"type":"string"},"refY":{"type":"string"},"result":{"type":"string"},"rx":{"type":"string"},"ry":{"type":"string"},"scale":{"type":"string"},"seed":{"type":"string"},"shape-rendering":{"type":"string"},"slope":{"type":"string"},"specularConstant":{"type":"string"},"specularExponent":{"type":"string"},"spreadMethod":{"type":"string"},"startOffset":{"type":"string"},"stdDeviation":{"type":"string"},"stitchTiles":{"type":"string"},"stop-color":{"$ref":"#/$defs/colorAttribute"},"stop-opacity":{"type":"string"},"stroke":{"description":"The stroke color or paint server reference for this element.","$ref":"#/$defs/paintAttribute"},"stroke-dasharray":{"type":"string"},"stroke-dashoffset":{"type":"string"},"stroke-linecap":{"type":"string"},"stroke-linejoin":{"type":"string"},"stroke-miterlimit":{"type":"string"},"stroke-opacity":{"type":"string"},"stroke-width":{"type":"string"},"style":{"description":"Inline CSS styles. External URL references and CSS injection patterns are not allowed.","allOf":[{"$ref":"#/$defs/noExternalUrlRef"},{"$ref":"#/$defs/noCssInjection"}]},"surfaceScale":{"type":"string"},"systemLanguage":{"type":"string"},"tabindex":{"type":"string"},"tableValues":{"type":"string"},"targetX":{"type":"string"},"targetY":{"type":"string"},"text-anchor":{"type":"string"},"text-decoration":{"type":"string"},"text-rendering":{"type":"string"},"textLength":{"type":"string"},"transform":{"type":"string"},"transform-origin":{"type":"string"},"type":{"type":"string"},"values":{"type":"string"},"viewBox":{"type":"string"},"visibility":{"type":"string"},"width":{"type":"string"},"word-spacing":{"type":"string"},"writing-mode":{"type":"string"},"x":{"type":"string"},"x1":{"type":"string"},"x2":{"type":"string"},"xChannelSelector":{"type":"string"},"y":{"type":"string"},"y1":{"type":"string"},"y2":{"type":"string"},"yChannelSelector":{"type":"string"},"z":{"type":"string"}},"additionalProperties":false}},"type":"object","properties":{"$schema":{"description":"The JSON Schema identifier for this document.","type":"string"},"$comment":{"description":"An optional comment or description for this avatar style definition.","type":"string"},"meta":{"description":"Metadata about the avatar style, such as license information, creator details, and source references.","type":"object","properties":{"license":{"description":"License information for the avatar style.","type":"object","properties":{"name":{"description":"The name of the license, e.g. `CC BY 4.0`.","type":"string"},"url":{"description":"A link to the full license text.","$ref":"#/$defs/safeUrl"},"text":{"description":"The full license text.","type":"string"}},"additionalProperties":false},"creator":{"description":"Information about the creator of the avatar style.","type":"object","properties":{"name":{"description":"The name of the creator.","type":"string"},"url":{"description":"A link to the creator's website or profile.","$ref":"#/$defs/safeUrl"}},"additionalProperties":false},"source":{"description":"Information about the original source of the artwork.","type":"object","properties":{"name":{"description":"The name of the original source.","type":"string"},"url":{"description":"A link to the original source.","$ref":"#/$defs/safeUrl"}},"additionalProperties":false}},"additionalProperties":false},"attributes":{"description":"Global SVG presentation attributes applied to the root `<svg>` element.","$ref":"#/$defs/attributes"},"canvas":{"description":"The main content of the avatar, defining the SVG structure, canvas dimensions, and element tree.","type":"object","properties":{"elements":{"description":"The list of SVG elements that make up the avatar.","type":"array","items":{"$ref":"#/$defs/element"}},"width":{"description":"The natural width of the avatar canvas in pixels. Must be at least 1.","type":"number","minimum":1},"height":{"description":"The natural height of the avatar canvas in pixels. Must be at least 1.","type":"number","minimum":1}},"required":["elements","width","height"],"additionalProperties":false},"components":{"description":"Named, reusable SVG components. Each component defines a set of variants that the PRNG can select from at render time.","type":"object","patternProperties":{"^[a-z][a-zA-Z0-9]*$":{"description":"A named component definition.","type":"object","properties":{"width":{"description":"The natural width of the component canvas in pixels.","type":"number","minimum":1},"height":{"description":"The natural height of the component canvas in pixels.","type":"number","minimum":1},"probability":{"description":"The probability (0–100) that this component is rendered at all. A value of 0 means never, 100 means always.","type":"number","minimum":0,"maximum":100},"rotate":{"description":"A range of rotation angles in degrees the PRNG can choose from. Each value must be between -360 and 360.","type":"array","items":{"type":"number","minimum":-360,"maximum":360},"minItems":1,"maxItems":2},"translate":{"description":"A positional translation applied to the component after placement.","type":"object","properties":{"x":{"description":"A range of horizontal translation values the PRNG can choose from.","type":"array","items":{"type":"number"},"minItems":1,"maxItems":2},"y":{"description":"A range of vertical translation values the PRNG can choose from.","type":"array","items":{"type":"number"},"minItems":1,"maxItems":2}},"additionalProperties":false},"variants":{"description":"The available visual variants of this component. The PRNG selects one variant per render.","type":"object","patternProperties":{"^[a-z][a-zA-Z0-9]*$":{"description":"A single variant of the component, containing its SVG element tree.","type":"object","properties":{"elements":{"description":"The SVG elements that make up this variant.","type":"array","items":{"$ref":"#/$defs/element"}}},"required":["elements"],"additionalProperties":false}},"additionalProperties":false}},"required":["width","height","variants"],"additionalProperties":false}},"additionalProperties":false},"colors":{"description":"Named color palettes used by the avatar. The PRNG selects colors from these groups at render time. Color groups can define constraints such as contrast or exclusion rules.","type":"object","patternProperties":{"^[a-z][a-zA-Z0-9]*$":{"description":"A named color.","type":"object","properties":{"values":{"description":"The list of hex color values the PRNG can choose from.","type":"array","items":{"type":"string","pattern":"^#([a-fA-F0-9]{3}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$"}},"notEqualTo":{"description":"A list of other color names. The selected color value must differ from the color values selected in those colors.","type":"array","items":{"$ref":"#/$defs/identifier"}},"contrastTo":{"description":"The name of another color. When specified, the PRNG is not used for selection — instead, the color value with the highest contrast against the selected color value of the referenced color is chosen.","$ref":"#/$defs/identifier"}},"required":["values"],"additionalProperties":false}},"additionalProperties":false}},"required":["canvas"],"additionalProperties":false}
|
|
1
|
+
{"$id":"https://cdn.hopjs.net/npm/@dicebear/schema@0.2.0/dist/definition.min.json","$schema":"https://json-schema.org/draft/2020-12/schema","$defs":{"identifier":{"description":"A camelCase identifier starting with a lowercase letter. Used for component, variable, and color references.","type":"string","pattern":"^[a-z][a-zA-Z0-9]*$"},"variableName":{"description":"A camelCase identifier starting with a lowercase letter. Used for variable references.","type":"string","enum":["initial","initials","fontWeight","fontFamily"]},"colorAttribute":{"description":"A color value, either as a direct color string (named color, hex, rgb(a), hsl(a), hsb(a)) or as a reference to a named color defined in the `colors` section.","anyOf":[{"type":"string","anyOf":[{"pattern":"^[a-zA-Z]+$"},{"pattern":"^#([a-fA-F0-9]{3}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$"},{"pattern":"^rgba?\\(\\s*\\d+\\s*,\\s*\\d+\\s*,\\s*\\d+\\s*(,\\s*[0-1](\\.\\d+)?\\s*)?\\)$"},{"pattern":"^hsla?\\(\\s*\\d+\\s*,\\s*\\d+%\\s*,\\s*\\d+%\\s*(,\\s*[0-1](\\.\\d+)?\\s*)?\\)$"},{"pattern":"^hsba?\\(\\s*\\d+\\s*,\\s*\\d+%\\s*,\\s*\\d+%\\s*(,\\s*[0-1](\\.\\d+)?\\s*)?\\)$"}]},{"description":"A reference to a named color. At render time, the PRNG selects a color value from the referenced color.","type":"object","properties":{"type":{"type":"string","const":"color"},"value":{"description":"The name of the color to reference.","$ref":"#/$defs/identifier"}},"required":["type","value"],"additionalProperties":false}]},"safeUrl":{"description":"A URL restricted to HTTP and HTTPS protocols.","type":"string","pattern":"^https?://"},"paintAttribute":{"description":"A paint value for `fill` and `stroke` attributes. Accepts all color formats from `colorAttribute` as well as local SVG paint server references in the form `url(#id)`, e.g. for gradients or patterns.","anyOf":[{"$ref":"#/$defs/colorAttribute"},{"type":"string","pattern":"^url\\(#[a-zA-Z_][a-zA-Z0-9_.-]*\\)$"}]},"noExternalUrlRef":{"description":"A string that must not contain external URL references (e.g. `url(https://...)`) or CSS escape sequences (backslash). Local references such as `url(#id)` are permitted.","type":"string","not":{"anyOf":[{"pattern":"[uU][rR][lL]\\s*\\(\\s*[^#)]"},{"pattern":"\\\\"}]}},"noCssInjection":{"description":"A string that must not contain CSS injection patterns, including `@`-rules, `expression()`, `behavior:`, or `-moz-binding`.","type":"string","not":{"anyOf":[{"pattern":"@"},{"pattern":"[eE][xX][pP][rR][eE][sS][sS][iI][oO][nN]\\s*\\("},{"pattern":"[bB][eE][hH][aA][vV][iI][oO][rR]\\s*:"},{"pattern":"-[mM][oO][zZ]-[bB][iI][nN][dD][iI][nN][gG]"},{"pattern":"\\\\"}]}},"element":{"description":"An SVG node. Can be an actual SVG element (`element`), a raw text node (`text`), or a reference to a named component (`component`).","type":"object","properties":{"name":{"description":"The SVG tag name. Only a safe subset of SVG elements is permitted; dangerous elements such as `script`, `foreignObject`, or `a` are excluded.","type":"string","enum":["circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","g","image","line","linearGradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialGradient","rect","stop","style","svg","switch","symbol","text","textPath","title","tspan","use","view"]},"type":{"description":"The node type. `element` renders an SVG tag, `text` renders a raw text node, `component` inserts a named component by reference.","type":"string","enum":["element","text","component"]},"value":{"description":"The text content for `text` nodes, the component name for `component` nodes, or the CSS content for `style` elements. Can also be a variable reference object to dynamically inject a runtime value.","anyOf":[{"type":"string"},{"description":"A reference to a runtime variable. The variable value is resolved and injected at render time.","type":"object","properties":{"type":{"type":"string","const":"variable"},"value":{"description":"The name of the variable to reference.","$ref":"#/$defs/variableName"}},"required":["type","value"],"additionalProperties":false}]},"attributes":{"description":"SVG presentation attributes to apply to this element.","$ref":"#/$defs/attributes"},"children":{"description":"Nested child elements. Only valid for `element` and `text` nodes.","type":"array","items":{"$ref":"#/$defs/element"}}},"required":["type"],"additionalProperties":false,"allOf":[{"if":{"properties":{"type":{"const":"component"}},"required":["type"]},"then":{"required":["value"],"properties":{"value":{"$ref":"#/$defs/identifier"}},"not":{"required":["children"]}}},{"if":{"properties":{"type":{"const":"element"}},"required":["type"]},"then":{"required":["name"],"if":{"properties":{"name":{"const":"style"}}},"then":{"properties":{"value":{"allOf":[{"$ref":"#/$defs/noExternalUrlRef"},{"$ref":"#/$defs/noCssInjection"}]}}},"else":{"not":{"required":["value"]}}}}]},"attributes":{"description":"A map of allowed SVG presentation attributes. Only a safe subset is permitted; event handlers (e.g. `onclick`) and namespace attributes (e.g. `xlink:href`) are not allowed.","type":"object","properties":{"alignment-baseline":{"type":"string"},"amplitude":{"type":"string"},"azimuth":{"type":"string"},"baseFrequency":{"type":"string"},"baseline-shift":{"type":"string"},"bias":{"type":"string"},"class":{"description":"CSS class name(s). Only alphanumeric characters, underscores, hyphens, and spaces are allowed.","type":"string","pattern":"^[a-zA-Z0-9_ -]+$"},"clipPathUnits":{"type":"string"},"clip-path":{"description":"References a clip path. External URL references are not allowed.","$ref":"#/$defs/noExternalUrlRef"},"clip-rule":{"type":"string"},"color":{"$ref":"#/$defs/colorAttribute"},"color-interpolation":{"type":"string"},"color-interpolation-filters":{"type":"string"},"crossorigin":{"type":"string"},"cx":{"type":"string"},"cy":{"type":"string"},"d":{"type":"string"},"decoding":{"type":"string"},"diffuseConstant":{"type":"string"},"direction":{"type":"string"},"display":{"type":"string"},"divisor":{"type":"string"},"dx":{"type":"string"},"dy":{"type":"string"},"edgeMode":{"type":"string"},"elevation":{"type":"string"},"exponent":{"type":"string"},"fill":{"description":"The fill color or paint server reference for this element.","$ref":"#/$defs/paintAttribute"},"fill-opacity":{"type":"string"},"fill-rule":{"type":"string"},"filter":{"description":"References a filter effect. External URL references are not allowed.","$ref":"#/$defs/noExternalUrlRef"},"filterUnits":{"type":"string"},"flood-color":{"$ref":"#/$defs/colorAttribute"},"flood-opacity":{"type":"string"},"font-family":{"type":"string"},"font-size":{"type":"string"},"font-size-adjust":{"type":"string"},"font-style":{"type":"string"},"font-variant":{"type":"string"},"font-weight":{"type":"string"},"fx":{"type":"string"},"fy":{"type":"string"},"gradientTransform":{"type":"string"},"gradientUnits":{"type":"string"},"height":{"type":"string"},"href":{"description":"A hyperlink reference. Only local fragment references (`#id`) and safe data URIs (raster images) are allowed.","anyOf":[{"type":"string","pattern":"^#[a-zA-Z0-9-]+$"},{"type":"string","pattern":"^data:image/(png|gif|jpg|jpeg|webp|avif);base64,[a-zA-Z0-9+/=]+$"}]},"id":{"description":"A unique identifier for the element. Must start with a letter or underscore.","type":"string","pattern":"^[a-zA-Z_][a-zA-Z0-9_.-]*$"},"image-rendering":{"type":"string"},"in":{"type":"string"},"in2":{"type":"string"},"intercept":{"type":"string"},"k1":{"type":"string"},"k2":{"type":"string"},"k3":{"type":"string"},"k4":{"type":"string"},"kernelMatrix":{"type":"string"},"kernelUnitLength":{"type":"string"},"lang":{"type":"string"},"lengthAdjust":{"type":"string"},"letter-spacing":{"type":"string"},"lighting-color":{"$ref":"#/$defs/colorAttribute"},"marker-end":{"description":"References a marker to draw at the end of a path. External URL references are not allowed.","$ref":"#/$defs/noExternalUrlRef"},"marker-mid":{"description":"References a marker to draw at intermediate vertices of a path. External URL references are not allowed.","$ref":"#/$defs/noExternalUrlRef"},"marker-start":{"description":"References a marker to draw at the start of a path. External URL references are not allowed.","$ref":"#/$defs/noExternalUrlRef"},"markerHeight":{"type":"string"},"markerUnits":{"type":"string"},"markerWidth":{"type":"string"},"mask":{"description":"References a mask element. External URL references are not allowed.","$ref":"#/$defs/noExternalUrlRef"},"maskContentUnits":{"type":"string"},"maskUnits":{"type":"string"},"media":{"type":"string"},"method":{"type":"string"},"mode":{"type":"string"},"numOctaves":{"type":"string"},"offset":{"type":"string"},"opacity":{"type":"string"},"operator":{"type":"string"},"order":{"type":"string"},"orient":{"type":"string"},"overflow":{"type":"string"},"paint-order":{"type":"string"},"path":{"type":"string"},"pathLength":{"type":"string"},"patternContentUnits":{"type":"string"},"patternTransform":{"type":"string"},"patternUnits":{"type":"string"},"points":{"type":"string"},"preserveAlpha":{"type":"string"},"preserveAspectRatio":{"type":"string"},"primitiveUnits":{"type":"string"},"r":{"type":"string"},"radius":{"type":"string"},"refX":{"type":"string"},"refY":{"type":"string"},"result":{"type":"string"},"rx":{"type":"string"},"ry":{"type":"string"},"scale":{"type":"string"},"seed":{"type":"string"},"shape-rendering":{"type":"string"},"slope":{"type":"string"},"specularConstant":{"type":"string"},"specularExponent":{"type":"string"},"spreadMethod":{"type":"string"},"startOffset":{"type":"string"},"stdDeviation":{"type":"string"},"stitchTiles":{"type":"string"},"stop-color":{"$ref":"#/$defs/colorAttribute"},"stop-opacity":{"type":"string"},"stroke":{"description":"The stroke color or paint server reference for this element.","$ref":"#/$defs/paintAttribute"},"stroke-dasharray":{"type":"string"},"stroke-dashoffset":{"type":"string"},"stroke-linecap":{"type":"string"},"stroke-linejoin":{"type":"string"},"stroke-miterlimit":{"type":"string"},"stroke-opacity":{"type":"string"},"stroke-width":{"type":"string"},"style":{"description":"Inline CSS styles. External URL references and CSS injection patterns are not allowed.","allOf":[{"$ref":"#/$defs/noExternalUrlRef"},{"$ref":"#/$defs/noCssInjection"}]},"surfaceScale":{"type":"string"},"systemLanguage":{"type":"string"},"tabindex":{"type":"string"},"tableValues":{"type":"string"},"targetX":{"type":"string"},"targetY":{"type":"string"},"text-anchor":{"type":"string"},"text-decoration":{"type":"string"},"text-rendering":{"type":"string"},"textLength":{"type":"string"},"transform":{"type":"string"},"transform-origin":{"type":"string"},"type":{"type":"string"},"values":{"type":"string"},"viewBox":{"type":"string"},"visibility":{"type":"string"},"width":{"type":"string"},"word-spacing":{"type":"string"},"writing-mode":{"type":"string"},"x":{"type":"string"},"x1":{"type":"string"},"x2":{"type":"string"},"xChannelSelector":{"type":"string"},"y":{"type":"string"},"y1":{"type":"string"},"y2":{"type":"string"},"yChannelSelector":{"type":"string"},"z":{"type":"string"}},"additionalProperties":false}},"type":"object","properties":{"$schema":{"description":"The JSON Schema identifier for this document.","type":"string"},"$comment":{"description":"An optional comment or description for this avatar style definition.","type":"string"},"meta":{"description":"Metadata about the avatar style, such as license information, creator details, and source references.","type":"object","properties":{"license":{"description":"License information for the avatar style.","type":"object","properties":{"name":{"description":"The name of the license, e.g. `CC BY 4.0`.","type":"string"},"url":{"description":"A link to the full license text.","$ref":"#/$defs/safeUrl"},"text":{"description":"The full license text.","type":"string"}},"additionalProperties":false},"creator":{"description":"Information about the creator of the avatar style.","type":"object","properties":{"name":{"description":"The name of the creator.","type":"string"},"url":{"description":"A link to the creator's website or profile.","$ref":"#/$defs/safeUrl"}},"additionalProperties":false},"source":{"description":"Information about the original source of the artwork.","type":"object","properties":{"name":{"description":"The name of the original source.","type":"string"},"url":{"description":"A link to the original source.","$ref":"#/$defs/safeUrl"}},"additionalProperties":false}},"additionalProperties":false},"attributes":{"description":"Global SVG presentation attributes applied to the root `<svg>` element.","$ref":"#/$defs/attributes"},"canvas":{"description":"The main content of the avatar, defining the SVG structure, canvas dimensions, and element tree.","type":"object","properties":{"elements":{"description":"The list of SVG elements that make up the avatar.","type":"array","items":{"$ref":"#/$defs/element"}},"width":{"description":"The natural width of the avatar canvas in pixels. Must be at least 1.","type":"number","minimum":1},"height":{"description":"The natural height of the avatar canvas in pixels. Must be at least 1.","type":"number","minimum":1}},"required":["elements","width","height"],"additionalProperties":false},"components":{"description":"Named, reusable SVG components. Each component defines a set of variants that the PRNG can select from at render time.","type":"object","patternProperties":{"^[a-z][a-zA-Z0-9]*$":{"description":"A named component definition.","type":"object","properties":{"width":{"description":"The natural width of the component canvas in pixels.","type":"number","minimum":1},"height":{"description":"The natural height of the component canvas in pixels.","type":"number","minimum":1},"probability":{"description":"The probability (0–100) that this component is rendered at all. A value of 0 means never, 100 means always.","type":"number","minimum":0,"maximum":100},"rotate":{"description":"A range of rotation angles in degrees the PRNG can choose from. Each value must be between -360 and 360.","type":"array","items":{"type":"number","minimum":-360,"maximum":360},"minItems":1,"maxItems":2},"translate":{"description":"A positional translation applied to the component after placement.","type":"object","properties":{"x":{"description":"A range of horizontal translation values the PRNG can choose from.","type":"array","items":{"type":"number"},"minItems":1,"maxItems":2},"y":{"description":"A range of vertical translation values the PRNG can choose from.","type":"array","items":{"type":"number"},"minItems":1,"maxItems":2}},"additionalProperties":false},"variants":{"description":"The available visual variants of this component. The PRNG selects one variant per render.","type":"object","patternProperties":{"^[a-z][a-zA-Z0-9]*$":{"description":"A single variant of the component, containing its SVG element tree.","type":"object","properties":{"elements":{"description":"The SVG elements that make up this variant.","type":"array","items":{"$ref":"#/$defs/element"}}},"required":["elements"],"additionalProperties":false}},"additionalProperties":false}},"required":["width","height","variants"],"additionalProperties":false}},"additionalProperties":false},"colors":{"description":"Named color palettes used by the avatar. The PRNG selects colors from these groups at render time. Color groups can define constraints such as contrast or exclusion rules.","type":"object","patternProperties":{"^[a-z][a-zA-Z0-9]*$":{"description":"A named color.","type":"object","properties":{"values":{"description":"The list of hex color values the PRNG can choose from.","type":"array","items":{"type":"string","pattern":"^#([a-fA-F0-9]{3}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$"}},"notEqualTo":{"description":"A list of other color names. The selected color value must differ from the color values selected in those colors.","type":"array","items":{"$ref":"#/$defs/identifier"}},"contrastTo":{"description":"The name of another color. When specified, the PRNG is not used for selection — instead, the color value with the highest contrast against the selected color value of the referenced color is chosen.","$ref":"#/$defs/identifier"}},"required":["values"],"additionalProperties":false}},"additionalProperties":false}},"required":["canvas"],"additionalProperties":false}
|
package/dist/options.min.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$id":"https://cdn.hopjs.net/npm/@dicebear/schema@0.
|
|
1
|
+
{"$id":"https://cdn.hopjs.net/npm/@dicebear/schema@0.2.0/dist/options.min.json","$schema":"https://json-schema.org/draft/2020-12/schema","title":"DiceBear options schema","type":"object","$defs":{"flip":{"type":"string","enum":["none","horizontal","vertical","both"]},"rotate":{"type":"number","minimum":-360,"maximum":360},"scale":{"type":"number","minimum":0},"translate":{"type":"number","minimum":-100,"maximum":100},"borderRadius":{"type":"number","minimum":0,"maximum":50},"color":{"type":"string","pattern":"^#?([a-fA-F0-9]{3}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$"},"colorFill":{"type":"string","enum":["solid","linear","radial"]},"fontFamilyName":{"type":"string","pattern":"^[a-zA-Z0-9 _\\-]+$"},"fontWeight":{"type":"integer","minimum":1,"maximum":1000}},"properties":{"seed":{"type":"string","description":"The starting value for the pseudorandom number generator (PRNG) used in the avatar generation process. This option is essential for creating unique and consistent avatars. By setting a specific seed, you ensure that the same sequence of random characteristics is applied, allowing identical avatars to be reproduced. This is especially valuable for maintaining consistency across sessions and allowing users to share or recreate their personalized avatars."},"size":{"type":"integer","description":"Specifies the dimensions of the avatar in pixels. If no size is specified, the avatar defaults to a responsive design or scales to 100% of its container. This flexibility allows the avatar to seamlessly adapt to different screen sizes and layouts, ensuring optimal display across devices and environments.","minimum":1},"idRandomization":{"type":"boolean","description":"Generates random values for all IDs present in the SVG. This process ensures that while the avatar appears visually identical, the underlying code remains unique. This is particularly useful for embedding the same avatar multiple times in a document without running into duplicate ID conflicts that can interfere with styles and scripts."},"flip":{"description":"Specifies how the avatar will be flipped. Options include `none` for no flip, `horizontal` for a left-to-right flip, `vertical` for an upside-down flip, and `both` for a complete flip. If specified as an array, the PRNG will choose from the available options.","oneOf":[{"$ref":"#/$defs/flip"},{"type":"array","items":{"$ref":"#/$defs/flip"}}]},"fontFamily":{"description":"Specifies the font family used for text rendering. If specified as an array, the PRNG will choose from the available options.","oneOf":[{"$ref":"#/$defs/fontFamilyName"},{"type":"array","items":{"$ref":"#/$defs/fontFamilyName"}}]},"fontWeight":{"description":"Specifies the font weight used for text rendering. The value must be an integer between 1 and 1000. If specified as an array, the PRNG will choose from the available options.","oneOf":[{"$ref":"#/$defs/fontWeight"},{"type":"array","items":{"$ref":"#/$defs/fontWeight"}}]},"scale":{"description":"Sets the scaling of the avatar. A value of `1` corresponds to the original size of the avatar. This setting affects the size of the avatar itself, but not the size of the avatar container; any excess content will be clipped. If specified as an array, the PRNG will define a value between the two given values, including the values themselves.","oneOf":[{"$ref":"#/$defs/scale"},{"type":"array","items":{"$ref":"#/$defs/scale"},"minItems":2,"maxItems":2}]},"borderRadius":{"description":"This is the radius of the corners of the avatar. This value can be a float or an integer. A value of 0 means that the avatar has sharp corners, while larger values result in more rounded corners. The maximum value is 50, which turns the avatar into a complete circle. If specified as an array, the PRNG will define a value between the two given values, including the values themselves.","oneOf":[{"$ref":"#/$defs/borderRadius"},{"type":"array","items":{"$ref":"#/$defs/borderRadius"},"minItems":2,"maxItems":2}]}},"patternProperties":{"^[a-z][a-zA-Z0-9]*Probability$":{"type":"number","description":"Represents the probability that a component of the avatar will be displayed. The value can be either a float or an integer, but is interpreted as a percentage. For example, a value of 0 means the part will never be displayed, while a value of 100 means it will always be displayed.","minimum":0,"maximum":100},"^[a-z][a-zA-Z0-9]*Variant$":{"description":"Specifies which variants of the avatar part can be selected by the PRNG. If specified as a string or as an array with only one value, the value is fixed. However, if specified as an array with multiple values, the PRNG will choose from the available options.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"^[a-z][a-zA-Z0-9]*Color$":{"description":"Specifies which colors for the avatar component can be selected by the PRNG. If specified as a string or array with only one value, the value is fixed. However, if specified as an array with multiple values, the PRNG will choose from the available options. The color must be specified as a hex value.","oneOf":[{"$ref":"#/$defs/color"},{"type":"array","items":{"$ref":"#/$defs/color"}}]},"^[a-z][a-zA-Z0-9]*ColorFill$":{"description":"Specifies the color fill method for the avatar component. Options include `solid` for a flat color, `linear` for a linear gradient, and `radial` for a radial gradient. If specified as a string or array with only one value, the value is fixed. However, if specified as an array with multiple values, the PRNG will choose from the available options.","oneOf":[{"$ref":"#/$defs/colorFill"},{"type":"array","items":{"$ref":"#/$defs/colorFill"}}]},"^(r|[a-z][a-zA-Z0-9]*R)otate$":{"description":"This is the rotation angle for the avatar or its parts. This value can be an integer or a float. A value of 0 results in no rotation, while values between -360 and 360 define the degree of rotation in both directions. If specified as an array, the PRNG will select a value within the specified range, including the values themselves. If not preceded by an avatar part, the option applies to the entire avatar.","oneOf":[{"$ref":"#/$defs/rotate"},{"type":"array","items":{"$ref":"#/$defs/rotate"},"minItems":1,"maxItems":2}]},"^(t|[a-z][a-zA-Z0-9]*T)ranslateY$":{"description":"This is the vertical translation of the avatar or its parts. This value can be an integer or a float. A value of 0 results in no translation, while positive values move the part down and negative values move it up. If specified as an array, the PRNG will select a value within the specified range, including the values themselves. If no avatar part is specified, the option applies to the entire avatar.","oneOf":[{"$ref":"#/$defs/translate"},{"type":"array","items":{"$ref":"#/$defs/translate"},"minItems":1,"maxItems":2}]},"^(t|[a-z][a-zA-Z0-9]*T)ranslateX$":{"description":"This is the horizontal translation of the avatar or its parts. This value can be an integer or a float. A value of 0 results in no translation, while positive values move the part to the right and negative values move it to the left. If specified as an array, the PRNG will select a value within the specified range, including the values themselves. If no avatar part is specified, the option applies to the entire avatar.","oneOf":[{"$ref":"#/$defs/translate"},{"type":"array","items":{"$ref":"#/$defs/translate"},"minItems":1,"maxItems":2}]}},"additionalProperties":false}
|
package/package.json
CHANGED
package/src/options.json
CHANGED
|
@@ -30,6 +30,10 @@
|
|
|
30
30
|
"type": "string",
|
|
31
31
|
"pattern": "^#?([a-fA-F0-9]{3}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$"
|
|
32
32
|
},
|
|
33
|
+
"colorFill": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"enum": ["solid", "linear", "radial"]
|
|
36
|
+
},
|
|
33
37
|
"fontFamilyName": {
|
|
34
38
|
"type": "string",
|
|
35
39
|
"pattern": "^[a-zA-Z0-9 _\\-]+$"
|
|
@@ -164,6 +168,20 @@
|
|
|
164
168
|
}
|
|
165
169
|
]
|
|
166
170
|
},
|
|
171
|
+
"^[a-z][a-zA-Z0-9]*ColorFill$": {
|
|
172
|
+
"description": "Specifies the color fill method for the avatar component. Options include `solid` for a flat color, `linear` for a linear gradient, and `radial` for a radial gradient. If specified as a string or array with only one value, the value is fixed. However, if specified as an array with multiple values, the PRNG will choose from the available options.",
|
|
173
|
+
"oneOf": [
|
|
174
|
+
{
|
|
175
|
+
"$ref": "#/$defs/colorFill"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"type": "array",
|
|
179
|
+
"items": {
|
|
180
|
+
"$ref": "#/$defs/colorFill"
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
]
|
|
184
|
+
},
|
|
167
185
|
"^(r|[a-z][a-zA-Z0-9]*R)otate$": {
|
|
168
186
|
"description": "This is the rotation angle for the avatar or its parts. This value can be an integer or a float. A value of 0 results in no rotation, while values between -360 and 360 define the degree of rotation in both directions. If specified as an array, the PRNG will select a value within the specified range, including the values themselves. If not preceded by an avatar part, the option applies to the entire avatar.",
|
|
169
187
|
"oneOf": [
|