{
  "openapi": "3.1.1",
  "info": {
    "title": "OKLCH Palette \u0026 Tint Scale Generator API",
    "version": "1.0.0",
    "summary": "Build perceptually even tint scales and hue harmonies in OKLCH, gamut-mapped for CSS.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://luminaoklchpalette.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Build perceptually even tint scales and hue harmonies in OKLCH, gamut-mapped for CSS.",
        "description": "Start from any CSS color and generate a 3–15 step lightness scale or an OKLCH hue harmony. Colors are gamut-mapped to sRGB or Display P3 with the CSS Color 4 algorithm; each step reports contrast with white and black, and you can download CSS with HEX fallbacks, GPL, JASC-PAL and SVG.\n\nMethodology:\n- Convert the base color to OKLCH (Ottosson 2020). A scale spreads OKLCH lightness evenly from the lightest to the darkest step at the base hue. Constant chroma keeps the base chroma; taper multiplies it by L(1 − L) relative to the base, capped at 1, so near-white and near-black steps carry less color.\n- A harmony keeps the base lightness and chroma and rotates the OKLCH hue: analogous ±spread, complementary 180°, split 180° ± spread, triadic 120°/240°, tetradic 60°/180°/240° and square 90° steps.\n- Every requested color is gamut-mapped to the target gamut with the CSS Color 4 binary search (chroma reduction at constant lightness and hue, deltaEOK JND 0.02). HEX values are sRGB; Display P3 palettes also export oklch() values for capable screens.\n- The report gives the smallest CIEDE2000 difference between neighbouring scale steps (or between any two harmony colors) and the WCAG 2 contrast of each color with white and black. Perceptual spacing is approximate: equal OKLCH steps are not guaranteed equal ΔE2000 steps.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "lumina_oklch_palette",
        "x-owner-app": "lumina",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LuminaOklchPaletteInput"
              },
              "examples": {
                "example1": {
                  "summary": "A nine-step teal scale",
                  "value": {
                    "base": "#164E63",
                    "mode": "scale",
                    "harmony": "triadic",
                    "spread": 30,
                    "count": 9,
                    "lightest": 97,
                    "darkest": 25,
                    "chroma": "taper",
                    "gamut": "srgb"
                  }
                },
                "example2": {
                  "summary": "Triadic harmony at equal lightness",
                  "value": {
                    "base": "oklch(0.62 0.15 30)",
                    "mode": "harmony",
                    "harmony": "triadic",
                    "spread": 30,
                    "count": 9,
                    "lightest": 97,
                    "darkest": 25,
                    "chroma": "taper",
                    "gamut": "srgb"
                  }
                },
                "example3": {
                  "summary": "Vivid Display P3 scale",
                  "value": {
                    "base": "oklch(0.65 0.26 300)",
                    "mode": "scale",
                    "harmony": "triadic",
                    "spread": 30,
                    "count": 11,
                    "lightest": 98,
                    "darkest": 20,
                    "chroma": "taper",
                    "gamut": "display-p3"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LuminaOklchPaletteResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "LuminaOklchPaletteInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "base": {
            "title": "Base color (CSS color)",
            "type": "string",
            "maxLength": 200,
            "default": "#164E63"
          },
          "mode": {
            "title": "Palette type",
            "type": "string",
            "enum": [
              "scale",
              "harmony"
            ],
            "default": "scale"
          },
          "count": {
            "title": "Scale steps",
            "type": "integer",
            "minimum": 3,
            "maximum": 15,
            "default": 9
          },
          "lightest": {
            "title": "Lightest step (OKLCH lightness %)",
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "default": 97
          },
          "darkest": {
            "title": "Darkest step (OKLCH lightness %)",
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "default": 25
          },
          "chroma": {
            "title": "Scale chroma",
            "type": "string",
            "enum": [
              "taper",
              "constant"
            ],
            "default": "taper"
          },
          "harmony": {
            "title": "Hue harmony",
            "type": "string",
            "enum": [
              "analogous",
              "complementary",
              "split",
              "triadic",
              "tetradic",
              "square"
            ],
            "default": "triadic"
          },
          "spread": {
            "title": "Analogous and split spread (degrees)",
            "type": "number",
            "minimum": 5,
            "maximum": 90,
            "default": 30
          },
          "gamut": {
            "title": "Target gamut",
            "type": "string",
            "enum": [
              "srgb",
              "display-p3"
            ],
            "default": "srgb"
          }
        },
        "required": []
      },
      "LuminaOklchPaletteResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "base",
              "colors",
              "minDeltaE2000",
              "minPair",
              "exports"
            ],
            "properties": {
              "base": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "hex",
                  "oklch"
                ],
                "properties": {
                  "hex": {
                    "type": "string"
                  },
                  "oklch": {
                    "type": "array",
                    "items": {
                      "type": "number"
                    },
                    "minItems": 3,
                    "maxItems": 3
                  }
                }
              },
              "colors": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "hex",
                    "oklch",
                    "css",
                    "requested",
                    "chromaReduced",
                    "contrastWhite",
                    "contrastBlack"
                  ],
                  "properties": {
                    "hex": {
                      "type": "string"
                    },
                    "oklch": {
                      "type": "array",
                      "items": {
                        "type": "number"
                      },
                      "minItems": 3,
                      "maxItems": 3
                    },
                    "css": {
                      "type": "string"
                    },
                    "requested": {
                      "type": "array",
                      "items": {
                        "type": "number"
                      },
                      "minItems": 3,
                      "maxItems": 3
                    },
                    "chromaReduced": {
                      "type": "boolean"
                    },
                    "contrastWhite": {
                      "type": "number"
                    },
                    "contrastBlack": {
                      "type": "number"
                    }
                  }
                }
              },
              "minDeltaE2000": {
                "type": "number"
              },
              "minPair": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "minItems": 2,
                "maxItems": 2
              },
              "exports": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "hex",
                  "gpl",
                  "jasc",
                  "css",
                  "svg",
                  "oklchCss"
                ],
                "properties": {
                  "hex": {
                    "type": "string"
                  },
                  "gpl": {
                    "type": "string"
                  },
                  "jasc": {
                    "type": "string"
                  },
                  "css": {
                    "type": "string"
                  },
                  "svg": {
                    "type": "string"
                  },
                  "oklchCss": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}