{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Meme",
"description": "A meme definition, usually writting in TOML.\n\n May extend other meme definitions and inherits all properties recursively\n that aren't overwritten. This allows creating meme templates using the same\n format. The templates can define text boxes, that are filled by memes that\n inherit from the template.",
"type": "object",
"properties": {
"text": {
"description": "The text that will be placed on top of the base.",
"type": "object",
"additionalProperties": {
"$ref": "#/$defs/Text"
}
}
},
"oneOf": [
{
"description": "Draw the meme onto a blank canvas.",
"type": "object",
"properties": {
"canvas": {
"$ref": "#/$defs/Canvas"
}
},
"required": [
"canvas"
]
},
{
"description": "Draw the meme onto an image.",
"type": "object",
"properties": {
"image": {
"type": "string"
}
},
"required": [
"image"
]
},
{
"description": "Extend another meme definition (e.g. a template).",
"type": "object",
"properties": {
"extends": {
"type": "string"
}
},
"required": [
"extends"
]
}
],
"unevaluatedProperties": false,
"$defs": {
"Canvas": {
"description": "A blank canvas that a meme will be drawn on.",
"type": "object",
"properties": {
"color": {
"description": "Background color of the canvas as a CSS color string.",
"type": [
"string",
"null"
]
},
"size": {
"description": "Dimensions of the canvas as a `width, height` pair.",
"type": [
"array",
"null"
],
"maxItems": 2,
"minItems": 2,
"prefixItems": [
{
"type": "integer",
"format": "uint32",
"minimum": 0
},
{
"type": "integer",
"format": "uint32",
"minimum": 0
}
]
}
},
"additionalProperties": false
},
"HAlign": {
"description": "Horizontal alignment.",
"type": "string",
"enum": [
"left",
"center",
"right"
]
},
"Text": {
"description": "Either the text content itself or the text box parameters.",
"anyOf": [
{
"description": "Just the text content.\n\n All other text properties must be defined in another layer\n (e.g. a template that is extended).",
"type": "string"
},
{
"description": "A text box that is placed on top of the base layer.",
"$ref": "#/$defs/TextBox"
}
]
},
"TextBox": {
"description": "A text box that is placed on top of the base layer.",
"type": "object",
"properties": {
"caps": {
"description": "Write the entire text content in capital letters.\n\n Defaults to `false`.",
"type": [
"boolean",
"null"
]
},
"color": {
"description": "Text color as a CSS color string.",
"type": [
"string",
"null"
]
},
"font": {
"description": "Font family name. Defaults to `sans-serif`.",
"type": [
"string",
"null"
]
},
"font-size": {
"description": "Maximum font size. Defaults to the text box height minus the outline\n width.\n\n If the text doesn't fit inside the text box, the font size is\n appropriately reduced.",
"type": [
"number",
"null"
],
"format": "float"
},
"halign": {
"description": "How to align the text horizontally inside the text box.\n\n Defaults to `center`.",
"anyOf": [
{
"$ref": "#/$defs/HAlign"
},
{
"type": "null"
}
]
},
"line-height": {
"description": "Line height relative to the font size.\n\n Defaults to `1.0`.",
"type": [
"number",
"null"
],
"format": "float"
},
"outline": {
"description": "Draw a colored outline around the text glyphs.",
"anyOf": [
{
"$ref": "#/$defs/TextOutline"
},
{
"type": "null"
}
]
},
"position": {
"description": "Top-left position of the text box as a `x, y` pair\n (before rotation is applied).",
"type": [
"array",
"null"
],
"maxItems": 2,
"minItems": 2,
"prefixItems": [
{
"type": "number",
"format": "float"
},
{
"type": "number",
"format": "float"
}
]
},
"rotate": {
"description": "Clockwise rotation around the center of the text box in degrees.\n\n Defaults to no rotation.",
"type": [
"number",
"null"
],
"format": "float"
},
"size": {
"description": "Dimensions of the text box as a `width, height` pair.",
"type": [
"array",
"null"
],
"maxItems": 2,
"minItems": 2,
"prefixItems": [
{
"type": "number",
"format": "float"
},
{
"type": "number",
"format": "float"
}
]
},
"text": {
"description": "Text content.",
"type": [
"string",
"null"
]
},
"valign": {
"description": "How to align the text vertically inside the text box.\n\n Defaults to `center`.",
"anyOf": [
{
"$ref": "#/$defs/VAlign"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
},
"TextOutline": {
"description": "Either a boolean to enable or disable the outline or the outline parameters.",
"anyOf": [
{
"type": "boolean"
},
{
"$ref": "#/$defs/TextOutlineParameters"
}
]
},
"TextOutlineParameters": {
"type": "object",
"properties": {
"color": {
"description": "Color of the outline as a CSS color string.",
"type": [
"string",
"null"
]
},
"enabled": {
"description": "Enables an outline around text glyphs.",
"type": "boolean",
"default": true
},
"width": {
"description": "Width of the outline.\n\n Values >=1.0 are interpreted an absolute size in Pixels, values <1.0 are\n interpreted relative to the font size.\n\n Defaults to `0.075`.",
"type": [
"number",
"null"
],
"format": "float"
}
},
"additionalProperties": false
},
"VAlign": {
"description": "Vertical alignment.",
"type": "string",
"enum": [
"top",
"center",
"bottom"
]
}
}
}