Background Generator Suite

Procedural art playground written in TypeScript. It includes multiple SVG generators (gradient abstractions, polygalaxy shards, painted terrains, neon skylines, and lush botanical gardens), lightweight CLIs for batch rendering, optional PNG export via sharp, and a minimal browser UI for live previews.

Requirements

The PNG export helper relies on sharp. Skip the PNG flags if you only need SVG.

CLI Generators

Each CLI stores output in ./outputs by default, writes PNGs via sharp, and accepts --png-scale to tweak quality. Use --no-png when you want to stick to SVGs only (handy for large batches).

Backgrounds

npx ts-node ts/generateBackground.ts --count 2 --width 3840 --height 2160 --ribbon-count 2

Options mirror the parameters inside ts/lib/background.ts so every geometric layer (blobs, ribbons, triangles, etc.) can be forced or randomized.

Polygalaxy

npx ts-node ts/generatePolygalaxy.ts --theme aurora --style loom --stars 600 --scanlines

Highlights:

Terrain Landscapes

npx ts-node ts/generateTerrain.ts --theme dusk --mountains 4 --fog --noise

--list-themes prints the biome catalog pulled from TERRAIN_THEMES.

Urban Skylines (new)

npx ts-node ts/generateSkyline.ts --theme ember --layers 4 --buildings-min 10 --buildings-max 22 --window-density 0.65 --no-png

Key flags:

Botanical Gardens (new)

npx ts-node ts/generateBotanical.ts --theme canopy --leaves 40 --fronds 18 --blooms 10 --noise

Highlights:

Batch All Generators

Want a quick sampler set? The helper script renders every generator n times (defaults to three) and converts the SVGs to PNGs.

npx ts-node ts/generateAll.ts --count 3

Flags:

Web Preview

npm run build:web
npx http-server web

Open http://localhost:8080 (or whichever port your static server uses) to fiddle with seeds and generators inside the simple HTML front end.

Repository Structure

Feel free to mix and match pieces—every generator exposes a generate*Svg function that returns { svg, seed, ... }, so you can embed them inside your own pipelines.

GitHub