diff --git a/docs/specs/layers.md b/docs/specs/layers.md index 4cb36a7..ca677cd 100644 --- a/docs/specs/layers.md +++ b/docs/specs/layers.md @@ -34,6 +34,11 @@ The `ty` property defines the specific layer type based on the following values: {schema_object:layers/null-layer} +

Solid Layer

+ +{schema_string:layers/solid-layer/description} + +{schema_object:layers/solid-layer}

Precomposition Layer

diff --git a/docs/specs/values.md b/docs/specs/values.md index 8b4f194..232a5b7 100644 --- a/docs/specs/values.md +++ b/docs/specs/values.md @@ -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. +

Hex Color

+Colors represented as a "#"-prefixed string, with two hexadecimal digits per +RGB component. + +* {lottie_hexcolor: #FF8000} +

Bezier Shape

{schema_string:values/bezier/description} diff --git a/schema/layers/all-layers.json b/schema/layers/all-layers.json index 4c80171..7caa044 100644 --- a/schema/layers/all-layers.json +++ b/schema/layers/all-layers.json @@ -7,6 +7,9 @@ { "$ref": "#/$defs/layers/null-layer" }, + { + "$ref": "#/$defs/layers/solid-layer" + }, { "$ref": "#/$defs/layers/shape-layer" } diff --git a/schema/layers/solid-layer.json b/schema/layers/solid-layer.json new file mode 100644 index 0000000..7bb296e --- /dev/null +++ b/schema/layers/solid-layer.json @@ -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" + ] + } + ] +} diff --git a/schema/values/hexcolor.json b/schema/values/hexcolor.json new file mode 100644 index 0000000..eb4878d --- /dev/null +++ b/schema/values/hexcolor.json @@ -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"] +} diff --git a/tools/lottie_markdown.py b/tools/lottie_markdown.py index dc410b3..c3b6411 100644 --- a/tools/lottie_markdown.py +++ b/tools/lottie_markdown.py @@ -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)