A conference identity often has to stretch across a website, printed schedules, room posters and preroll slides. The trick is an aesthetic flexible enough to vary per artifact while still reading as one system. Overlapping rectangles in a randomized pattern over a deliberately limited palette are one option: a background that can sit beneath type blocks and adapt to each format.
Randomness is the awkward part inside design software. Doing the generation in the browser with JavaScript and SVG avoids scripting the design tool, and makes the output easy to vary on demand.
Defining the palette and rectangle generator
The color palette can be declared as an array of hex values. A function then produces a set of rectangles between a supplied minimum and maximum count:
const colorPalette = ["#9B2E69", "#D93750", "#E2724F", "#F3DC7B", "#4E9397"];
const rand = (max) => {
return Math.floor(Math.random() * max);
};
const makeRects = (maxX, maxY) => {
let rects = "";
for (let i = 0; i < 100; i++) {
rects += `
<rect
x="${rand(maxX + 50) - 50}"
y="${rand(maxY + 50) - 50}"
width="${rand(200) + 20}"
height="${rand(200) + 20}"
opacity="0.8${rand(10)}"
fill="${colorPalette[rand(5)]}"
/>
`;
}
return rects;
};
Feed the output into an <svg> and you have generative artwork. Each run yields a new composition, so producing fresh SVGs is a matter of re-running the code.




Sizing to the viewport
A client usually wants the same aesthetic at a different aspect ratio, immediately. Working in the browser helps: resizing the window resizes the composition. Sizing the parent SVG to the full viewport gives a wide, squat result when the window is wide and squat.
const makeSVG = () => {
const w = document.body.offsetWidth;
const h = document.body.offsetHeight;
const svg = `<svg width="${w}" height="${h}">
${makeRects(w, h)}
</svg>`;
return svg;
};

Exporting SVG
Getting the result out of the browser as a file needs no native platform APIs. Take the SVG as a string, place it in a data URL as the href of a link, and programmatically click that link — triggered from a button.
function download(filename, text) {
var pom = document.createElement("a");
pom.setAttribute(
"href",
"data:text/plain;charset=utf-8," + encodeURIComponent(text)
);
pom.setAttribute("download", filename);
if (document.createEvent) {
var event = document.createEvent("MouseEvents");
event.initEvent("click", true, true);
pom.dispatchEvent(event);
} else {
pom.click();
}
}
const downloadSvgButton = document.querySelector("#download-svg-button");
downloadSvgButton.addEventListener("click", () => {
download("art.svg", window.globalSVGStore);
});
Exporting PNG
Not every client has software that handles SVG, so a PNG path helps. A high-density screenshot is a reasonable fallback, but once the SVG download works, PNG support is little extra effort. FileSaver.js can save a <canvas> via toBlob, and canvg converts the <svg> into that canvas. When the generator runs, paint the SVG to a canvas that automatically matches its size — already the viewport size.
const setup = () => {
const v = canvg.Canvg.fromString(ctx, makeSVG());
v.start();
};
That setup function can be bound to its own button and invoked on window resize.
The implementation stays deliberately simple. It could, for instance, choose the rectangle count based on viewport area. The appeal is the pattern itself: a small art-generating machine for turning out design assets and solving a real client request.



