genart.dev

.genart File

Complete specification of the .genart sketch file format

.genart File Format

A .genart file is a self-contained JSON document representing a single generative art sketch. It includes metadata, renderer configuration, parameters, colors, algorithm code, and state.

Format version

Current version: 1.1

The genart field specifies the format version. Version 1.0 files without a renderer field default to { "type": "p5" }.

Required fields

FieldTypeDescription
genartstringFormat version ("1.1")
idstringUnique sketch identifier
titlestringHuman-readable title
createdstringISO 8601 timestamp
modifiedstringISO 8601 timestamp
rendererobjectRenderer configuration
canvasobjectCanvas dimensions
parametersarrayParameter definitions
colorsarrayColor palette definitions
stateobjectCurrent runtime state
algorithmstringAlgorithm source code

Renderer

{
  "renderer": {
    "type": "p5",
    "version": "1.x"
  }
}

Supported types: p5, three, glsl, canvas2d, svg. See Renderers for details.

Canvas

Dimensions can be explicit or reference a preset:

{ "canvas": { "width": 1200, "height": 1200 } }
{ "canvas": { "preset": "hd-1920x1080" } }

See Canvas Presets for all 17 built-in presets.

Parameters

Each parameter defines a control for the algorithm:

{
  "parameters": [
    {
      "key": "amplitude",
      "label": "Wave Amplitude",
      "type": "number",
      "min": 5,
      "max": 80,
      "step": 1,
      "default": 40,
      "tab": "waves"
    }
  ]
}
FieldTypeRequiredDescription
keystringyesUnique identifier within the sketch
labelstringnoDisplay label
typestringyes"number", "boolean", "string", "select"
minnumbernoMinimum value (number type)
maxnumbernoMaximum value (number type)
stepnumbernoStep increment (number type)
defaultanyyesDefault value
tabstringnoTab group assignment

Parameter keys must be unique. The default value must be within min/max range.

Colors

Color palette definitions:

{
  "colors": [
    { "key": "background", "label": "Background", "default": "#0A0A0A" },
    { "key": "stroke", "label": "Stroke Color", "default": "#22D3EE" }
  ]
}

Themes

Optional named color presets:

{
  "themes": [
    {
      "name": "Neon",
      "colors": ["#0A0A0A", "#00FF41", "#FF00FF"]
    },
    {
      "name": "Warm",
      "colors": ["#1A0A00", "#FF6B35", "#FFD700"]
    }
  ]
}

State

Current runtime values:

{
  "state": {
    "seed": 42,
    "params": { "amplitude": 40, "frequency": 0.05 },
    "colorPalette": ["#0A0A0A", "#22D3EE"]
  }
}

Snapshots

Historical state captures:

{
  "snapshots": [
    {
      "id": "snap-001",
      "label": "Best composition",
      "timestamp": "2026-02-14T12:00:00Z",
      "state": { "seed": 99, "params": { "amplitude": 60 }, "colorPalette": ["#0A0A0A", "#FF6B35"] },
      "thumbnailDataUrl": "data:image/jpeg;base64,..."
    }
  ]
}

Optional fields

FieldTypeDescription
subtitlestringShort description
skillsstring[]Design skills used (e.g., ["golden-ratio", "complementary"])
philosophystringMarkdown text explaining the artistic intent
tabsobject[]Tab definitions for parameter grouping
themesobject[]Named color presets
snapshotsobject[]Historical state snapshots

Minimal example

{
  "genart": "1.1",
  "id": "minimal-example",
  "title": "Minimal Example",
  "created": "2026-02-14T00:00:00Z",
  "modified": "2026-02-14T00:00:00Z",
  "renderer": { "type": "p5", "version": "1.x" },
  "canvas": { "width": 1200, "height": 1200 },
  "parameters": [],
  "colors": [],
  "state": { "seed": 42, "params": {}, "colorPalette": [] },
  "algorithm": "function sketch(p, state) {\n  p.setup = () => {\n    p.createCanvas(state.canvas.width, state.canvas.height);\n    p.background(20);\n  };\n  p.draw = () => {};\n  return { initializeSystem() {} };\n}"
}

Validation rules

The parser rejects files that:

  • Are missing any required field (id, algorithm, etc.)
  • Have an unknown renderer.type
  • Have an unrecognized canvas.preset
  • Have duplicate parameter keys
  • Have a default value outside the min/max range