function tiledTile(width, height, data) {
const split = 0.7;
const [sWidth, sHeight] = [width, height].map((l) => l * split);
const newColorIndex =
data.n % 2 === 0
? data.colorIndex
: (data.colorIndex + 1) % data.colors.length;
const big = getTiles(sWidth, sHeight, data.n, data.n, checkerTile, data);
const narrow = getTiles(
width - sWidth,
sHeight,
data.n,
data.n,
checkerTile,
{ ...data, colorIndex: newColorIndex }
);
const wide = getTiles(sWidth, height - sHeight, data.n, data.n, checkerTile, {
...data,
colorIndex: newColorIndex
});
const small = getTiles(
width - sWidth,
height - sHeight,
data.n,
data.n,
checkerTile,
data
);
return [
svg`${big}
<g transform="translate(${sWidth}, 0)">${narrow}</g>
<g transform="translate(0, ${sHeight})">${wide}</g>
<g transform="translate(${sWidth}, ${sHeight})">${small}</g>
`,
data
];
}