{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "name": "Ditherlab Background Kit",
  "id": "ditherlab-background-kit",
  "version": "1.0.0",
  "status": "stable",
  "description": "A dependency-free WebGL2 module for Ditherlab-derived procedural scenes with palette quantization and dithering, designed for website backgrounds.",
  "canonical": "https://ditherlab.app/agents/",
  "documentation": "https://ditherlab.app/agents/index.md",
  "module": "https://ditherlab.app/agent-kit/v1/ditherlab-background.js",
  "example": "https://ditherlab.app/agent-kit/v1/example.html",
  "export": "createDitherlabBackground",
  "license": {
    "spdx": "Apache-2.0",
    "url": "https://ditherlab.app/agent-kit/v1/LICENSE",
    "notice": "https://ditherlab.app/agent-kit/v1/NOTICE",
    "scope": "Ditherlab Background Kit v1 only; this does not license the complete Ditherlab editor."
  },
  "runtime": {
    "language": "JavaScript ES module",
    "dependencies": [],
    "requires": ["WebGL2", "ES modules"],
    "fallback_required": true,
    "cross_origin_import": true
  },
  "scenes": [
    { "id": "mesh", "label": "Mesh Gradient", "defaultPalette": ["#5b3df5", "#ff5ea1", "#ffb86c", "#2de2e6", "#151530"] },
    { "id": "neuro", "label": "Neuro Noise", "defaultPalette": ["#03040c", "#3d5afe", "#a7f3ff"] },
    { "id": "warp", "label": "Warp Field", "defaultPalette": ["#0d0221", "#f6019d", "#2de2e6", "#fdfdfd"] },
    { "id": "smoke", "label": "Smoke", "defaultPalette": ["#050510", "#312e81", "#7c6cff", "#e0e7ff"] },
    { "id": "voronoi", "label": "Voronoi Flow", "defaultPalette": ["#0a0a0c", "#1b9aaa", "#ffd23f", "#ff4858", "#f6f4e6"] },
    { "id": "blobs", "label": "Metaballs", "defaultPalette": ["#06060a", "#22d3ee", "#8b7cff", "#f0abfc"] }
  ],
  "ditherTreatments": [
    { "id": "quantize", "label": "Palette quantize" },
    { "id": "bayer8", "label": "Bayer ordered 8x8" },
    { "id": "noise", "label": "White noise" },
    { "id": "halftone-dots", "label": "Halftone dots" },
    { "id": "halftone-lines", "label": "Halftone lines" }
  ],
  "options": {
    "scene": { "type": "string", "enum": ["mesh", "neuro", "warp", "smoke", "voronoi", "blobs"], "default": "smoke" },
    "treatment": { "type": "string", "enum": ["quantize", "bayer8", "noise", "halftone-dots", "halftone-lines"], "default": "bayer8" },
    "dither": { "type": "string", "aliasFor": "treatment" },
    "palette": { "type": "array", "items": "CSS hex color", "minItems": 2, "maxItems": 8, "default": "selected scene defaultPalette" },
    "pixelSize": { "type": "number", "minimum": 1, "maximum": 256, "default": 5, "unit": "CSS pixels" },
    "halftoneScale": { "type": "number", "minimum": 1.5, "maximum": 64, "default": 6, "unit": "dither cells" },
    "halftoneSize": { "type": "number", "aliasFor": "halftoneScale" },
    "ditherStrength": { "type": "number", "minimum": 0, "maximum": 2, "default": 0.9 },
    "scale": { "type": "number", "minimum": 0.05, "maximum": 10, "default": 1 },
    "speed": { "type": "number", "minimum": -2, "maximum": 2, "default": 0.11, "unit": "cycles per second" },
    "seed": { "type": "number", "default": "random" },
    "phase": { "type": "number", "default": 0, "normalized": true },
    "maxDpr": { "type": "number", "minimum": 1, "maximum": 2, "default": 2 },
    "respectReducedMotion": { "type": "boolean", "default": true },
    "autoResize": { "type": "boolean", "default": true },
    "autostart": { "type": "boolean", "default": false },
    "preserveDrawingBuffer": { "type": "boolean", "default": false }
  },
  "methods": {
    "start": "Start or resume rendering. In reduced-motion mode, renders one still frame.",
    "pause": "Pause animation without releasing WebGL resources.",
    "set": "Validate and apply a partial options object, then render.",
    "resize": "Synchronize the drawing buffer with the canvas display size.",
    "destroy": "Stop rendering, disconnect observers/listeners, and release WebGL resources."
  },
  "integrationRequirements": [
    "Keep semantic content and controls in HTML, not in the canvas.",
    "Mark decorative canvases aria-hidden and preserve interaction contrast.",
    "Provide a static no-JavaScript and no-WebGL2 fallback.",
    "Respect reduced motion and pause while the document is hidden.",
    "Call destroy when the owning component unmounts.",
    "Do not import or recreate the full Ditherlab editor."
  ],
  "provenance": {
    "ditherlabSource": "https://github.com/jjanousek/dither_app/tree/55a8d46ada71a6969678eaf642caa71725df0307",
    "paperShaders": "https://github.com/paper-design/shaders",
    "accuracy": "Web-background adaptation of Ditherlab shader techniques; not byte-identical to the full editor renderer."
  }
}
