Indeed? Interesting.
Ima sure that this has been used before, but how about using certain JSON with functions to add HTML elements to a page with themes.
function newRect({x,y,bg,color}) {
var newDiv = document.createElement("div");
newDiv.style.transform="translate("+this.x+"px,"+this.y+"px)";
…rest of code
}