{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://fm.video/skins/skin.schema.json",
  "title": "FM.video skin",
  "description": "A skin for FM.video: colours and a few style choices, as data. No CSS, no URLs, no code. FM.video also checks contrast when a skin is imported, which a schema cannot express. Guide: https://fm.video/skins/guide",
  "type": "object",
  "additionalProperties": false,
  "required": ["id", "name", "author", "version", "mode", "tokens"],
  "properties": {
    "$schema": {
      "type": "string",
      "description": "Optional. Lets an editor check the file. FM.video ignores it."
    },
    "id": {
      "type": "string",
      "description": "Unique, kebab-case. Built-in ids (transmission, pixel, hifi, midnight, daylight, sunday-paper, sunset, lagoon, teletext, high-contrast, studio, airmail, sorbet, cassette, pop-art, memphis, carnival, hideous) are reserved.",
      "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
      "maxLength": 40
    },
    "name": {
      "type": "string",
      "description": "Shown on the skin's card. Plain text, no links.",
      "minLength": 1,
      "maxLength": 40
    },
    "author": {
      "type": "string",
      "description": "Who made it. Plain text, no links.",
      "minLength": 1,
      "maxLength": 40
    },
    "version": {
      "const": 1,
      "description": "The skin format version. Always 1 for now."
    },
    "description": {
      "type": "string",
      "description": "One line about the skin. Plain text, no links.",
      "maxLength": 200
    },
    "mode": {
      "enum": ["dark", "light"],
      "description": "dark: the canvas is darker than the text. light: the other way round (experimental)."
    },
    "tokens": {
      "type": "object",
      "description": "The colours. Every value is #rgb or #rrggbb. Leave one out and FM.video works it out.",
      "additionalProperties": false,
      "properties": {
        "canvas": { "$ref": "#/$defs/hex", "description": "The page background, behind everything." },
        "surface": { "$ref": "#/$defs/hex", "description": "Cards, rows, tiles and sheets." },
        "elevated": { "$ref": "#/$defs/hex", "description": "Menus, the player bar and anything that floats over the page." },
        "line": { "$ref": "#/$defs/hex", "description": "Hairlines and borders." },
        "ink": { "$ref": "#/$defs/hex", "description": "Main text and icons. Also the fill of the selected filter chip." },
        "inkDim": { "$ref": "#/$defs/hex", "description": "Secondary text: artist names, descriptions, idle icons." },
        "inkMute": { "$ref": "#/$defs/hex", "description": "Captions, counts and small labels." },
        "accent": { "$ref": "#/$defs/hex", "description": "Highlights: the playing song, the active tab, links, the focus ring, the equaliser bars." },
        "action": { "$ref": "#/$defs/hex", "description": "The fill of the main button (play) and of progress bars. Follows accent unless you set it." },
        "onAccent": { "$ref": "#/$defs/hex", "description": "Text and icons sitting on an accent or action fill." },
        "scrim": { "$ref": "#/$defs/hex", "description": "The veil over artwork that makes text on it readable, and the dim behind dialogs." },
        "success": { "$ref": "#/$defs/hex", "description": "Good news: saved, added, climbing." },
        "warn": { "$ref": "#/$defs/hex", "description": "Warnings and things that need a look." },
        "info": { "$ref": "#/$defs/hex", "description": "Neutral notices." },
        "spectrumWarm": { "$ref": "#/$defs/hex", "description": "First colour of decorative gradients." },
        "spectrumMid": { "$ref": "#/$defs/hex", "description": "Middle colour of decorative gradients." },
        "spectrumCool": { "$ref": "#/$defs/hex", "description": "Last colour of decorative gradients, and casting." }
      }
    },
    "shape": {
      "enum": ["brand", "square", "soft", "round"],
      "description": "Corners. brand: as designed. square: none, pills included. soft: small. round: big."
    },
    "texture": {
      "enum": ["none", "scanlines", "grid", "noise", "dots"],
      "description": "A faint pattern on the page canvas. Never over the video."
    },
    "shadow": {
      "enum": ["soft", "hard", "none"],
      "description": "soft: blurred, as designed. hard: solid offset shadows. none: flat."
    },
    "fonts": {
      "type": "object",
      "description": "A typeface for each role, from the bundled list. A skin cannot load a font.",
      "additionalProperties": false,
      "properties": {
        "display": { "$ref": "#/$defs/font", "description": "Headings." },
        "body": { "$ref": "#/$defs/font", "description": "Everything you read." },
        "mono": { "$ref": "#/$defs/font", "description": "Numbers, times and small labels." }
      }
    }
  },
  "$defs": {
    "hex": {
      "type": "string",
      "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
    },
    "font": {
      "enum": [
        "big-shoulders",
        "space-grotesk",
        "space-mono",
        "pixel",
        "pixel-sans",
        "terminal",
        "matrix",
        "system",
        "serif",
        "mono"
      ]
    }
  }
}
