{
  "openapi": "3.1.1",
  "info": {
    "title": "Layer Blend Color Mixer API",
    "version": "1.0.0",
    "summary": "Preview eight blend modes and opacity for two opaque colors.",
    "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://luminablendmixer.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Preview eight blend modes and opacity for two opaque colors.",
        "description": "Mix a source HEX color over a backdrop using normal, multiply, screen, overlay, darken, lighten, difference or exclusion. Calculate the final sRGB color at a chosen layer opacity.\n\nMethodology:\n- Separable blend formulas operate on normalized sRGB channel values. Source-over with an opaque backdrop is (1 − opacity) × backdrop + opacity × blend(backdrop,source).\n- Results round to 8-bit RGB. This calculator assumes opaque colors; image layer alpha is additionally handled by the browser compositor.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "lumina_blend_mixer",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LuminaBlendMixerInput"
              },
              "examples": {
                "example1": {
                  "summary": "A gentle green multiply tint",
                  "value": {
                    "backdrop": "#c8d6bd",
                    "source": "#426a60",
                    "opacity": 60,
                    "mode": "multiply"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LuminaBlendMixerResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "LuminaBlendMixerInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "backdrop": {
            "title": "Backdrop HEX",
            "type": "string",
            "maxLength": 7,
            "default": "#c8d6bd"
          },
          "source": {
            "title": "Source HEX",
            "type": "string",
            "maxLength": 7,
            "default": "#426a60"
          },
          "opacity": {
            "title": "Source opacity (%)",
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "default": 60
          },
          "mode": {
            "title": "Blend mode",
            "type": "string",
            "enum": [
              "normal",
              "multiply",
              "screen",
              "overlay",
              "darken",
              "lighten",
              "difference",
              "exclusion"
            ],
            "default": "multiply"
          }
        },
        "required": []
      },
      "LuminaBlendMixerResult": {
        "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": [
              "hex",
              "r",
              "g",
              "b",
              "opacity",
              "mode"
            ],
            "properties": {
              "hex": {
                "type": "string"
              },
              "r": {
                "type": "integer"
              },
              "g": {
                "type": "integer"
              },
              "b": {
                "type": "integer"
              },
              "opacity": {
                "type": "number"
              },
              "mode": {
                "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"
              }
            }
          }
        }
      }
    }
  }
}