{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://huekit.co/api/v1/schema.json",
  "title": "HueKit color dataset",
  "description": "Schema for /api/v1/colors.json, version 1.0.0.",
  "type": "object",
  "required": [
    "version",
    "license",
    "count",
    "colors"
  ],
  "properties": {
    "version": {
      "type": "string"
    },
    "license": {
      "type": "string"
    },
    "licenseUrl": {
      "type": "string",
      "format": "uri"
    },
    "count": {
      "type": "integer",
      "minimum": 1
    },
    "colors": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/color"
      }
    }
  },
  "$defs": {
    "color": {
      "type": "object",
      "required": [
        "hex",
        "slug",
        "rgb",
        "hsl",
        "hsv",
        "cmyk",
        "lab",
        "lch",
        "oklch",
        "contrast"
      ],
      "properties": {
        "hex": {
          "type": "string",
          "pattern": "^#[0-9A-F]{6}$"
        },
        "slug": {
          "type": "string",
          "pattern": "^[0-9a-f]{6}$"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "family": {
          "type": [
            "string",
            "null"
          ]
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "rgb": {
          "type": "object",
          "required": [
            "r",
            "g",
            "b"
          ],
          "properties": {
            "r": {
              "type": "integer",
              "minimum": 0,
              "maximum": 255
            },
            "g": {
              "type": "integer",
              "minimum": 0,
              "maximum": 255
            },
            "b": {
              "type": "integer",
              "minimum": 0,
              "maximum": 255
            }
          }
        },
        "hsl": {
          "type": "object",
          "required": [
            "h",
            "s",
            "l"
          ],
          "properties": {
            "h": {
              "type": "number",
              "minimum": 0,
              "maximum": 360
            },
            "s": {
              "type": "number",
              "minimum": 0,
              "maximum": 100
            },
            "l": {
              "type": "number",
              "minimum": 0,
              "maximum": 100
            }
          }
        },
        "hsv": {
          "type": "object",
          "required": [
            "h",
            "s",
            "v"
          ],
          "properties": {
            "h": {
              "type": "number",
              "minimum": 0,
              "maximum": 360
            },
            "s": {
              "type": "number",
              "minimum": 0,
              "maximum": 100
            },
            "v": {
              "type": "number",
              "minimum": 0,
              "maximum": 100
            }
          }
        },
        "cmyk": {
          "type": "object",
          "required": [
            "c",
            "m",
            "y",
            "k"
          ],
          "properties": {
            "c": {
              "type": "number",
              "minimum": 0,
              "maximum": 100
            },
            "m": {
              "type": "number",
              "minimum": 0,
              "maximum": 100
            },
            "y": {
              "type": "number",
              "minimum": 0,
              "maximum": 100
            },
            "k": {
              "type": "number",
              "minimum": 0,
              "maximum": 100
            }
          }
        },
        "lab": {
          "type": "object",
          "required": [
            "l",
            "a",
            "b"
          ],
          "properties": {
            "l": {
              "type": "number"
            },
            "a": {
              "type": "number"
            },
            "b": {
              "type": "number"
            }
          }
        },
        "lch": {
          "type": "object",
          "required": [
            "l",
            "c",
            "h"
          ],
          "properties": {
            "l": {
              "type": "number"
            },
            "c": {
              "type": "number"
            },
            "h": {
              "type": "number",
              "minimum": 0,
              "maximum": 360
            }
          }
        },
        "oklch": {
          "type": "object",
          "required": [
            "l",
            "c",
            "h"
          ],
          "properties": {
            "l": {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            },
            "c": {
              "type": "number",
              "minimum": 0
            },
            "h": {
              "type": "number",
              "minimum": 0,
              "maximum": 360
            }
          }
        },
        "contrast": {
          "type": "object",
          "required": [
            "onWhite",
            "onInkBlack"
          ],
          "properties": {
            "onWhite": {
              "type": "number",
              "minimum": 1,
              "maximum": 21
            },
            "onInkBlack": {
              "type": "number",
              "minimum": 1,
              "maximum": 21
            },
            "aaNormalOnWhite": {
              "type": "boolean"
            },
            "aaaNormalOnWhite": {
              "type": "boolean"
            }
          }
        },
        "shades": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "tints": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "nearest": {
          "type": "object"
        }
      }
    }
  }
}