Skip to content

Commit

Permalink
Solid Layer schema and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
fmalita authored Mar 21, 2024
1 parent fd5c206 commit d58ed84
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/specs/layers.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ The `ty` property defines the specific layer type based on the following values:

{schema_object:layers/null-layer}

<h3 id="solid-layer">Solid Layer</h3>

{schema_string:layers/solid-layer/description}

{schema_object:layers/solid-layer}

<h3 id="precomposition-layer">Precomposition Layer</h3>

Expand Down
6 changes: 6 additions & 0 deletions docs/specs/values.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ for example:
Note sometimes you might find color values with 4 components (the 4th being alpha)
but most players ignore the last component.

<h2 id="hexcolor">Hex Color</h2>
Colors represented as a "#"-prefixed string, with two hexadecimal digits per
RGB component.

* {lottie_hexcolor: #FF8000}

<h2 id="bezier">Bezier Shape</h2>

{schema_string:values/bezier/description}
Expand Down
3 changes: 3 additions & 0 deletions schema/layers/all-layers.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
{
"$ref": "#/$defs/layers/null-layer"
},
{
"$ref": "#/$defs/layers/solid-layer"
},
{
"$ref": "#/$defs/layers/shape-layer"
}
Expand Down
43 changes: 43 additions & 0 deletions schema/layers/solid-layer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"title": "Solid Layer",
"description": "Solid color, rectangle-shaped layer",
"allOf": [
{
"$ref": "#/$defs/layers/visual-layer"
},
{
"type": "object",
"properties": {
"ty": {
"title": "Type",
"description": "Layer type",
"type": "integer",
"const": 1
},
"sw": {
"title": "Width",
"description": "Solid rectangle width",
"type": "integer"
},
"sh": {
"title": "Height",
"description": "Solid rectangle height",
"type": "integer"
},
"sc": {
"title": "Color",
"description": "Solid fill color",
"$ref": "#/$defs/values/hexcolor"
}
},
"required": [
"ty",
"sw",
"sh",
"sc"
]
}
]
}
8 changes: 8 additions & 0 deletions schema/values/hexcolor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "string",
"title": "Hex Color",
"description": "Color value in hexadecimal format, with two digits per component ('#RRGGBB')",
"pattern": "^#([a-fA-F0-9]{6})$",
"examples": ["#FF00AA"]
}
1 change: 1 addition & 0 deletions tools/lottie_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -1113,6 +1113,7 @@ def extendMarkdown(self, md):
md.inlinePatterns.register(DocsLink(md, ts), "docs_link", 175)
md.inlinePatterns.register(SubTypeTable(md, ts), "schema_subtype_table", 175)
md.inlinePatterns.register(LottieColor(r'{lottie_color:(([^,]+),\s*([^,]+),\s*([^,]+))}', md, 1), 'lottie_color', 175)
md.inlinePatterns.register(LottieColor(r'{lottie_hexcolor:\s*(#([a-fA-F0-9]{6}|[a-fA-F0-9]{3}))}', md, -1), 'lottie_hexcolor', 175)
md.inlinePatterns.register(SchemaInheritance(md, ts), "schema_inheritance", 175)
md.inlinePatterns.register(BCP14(md), "bcp14", 175)
md.inlinePatterns.register(RfcLink(md), "rfc", 175)
Expand Down

0 comments on commit d58ed84

Please sign in to comment.