colours more random?
ser opened this issue · 1 comments
ser commented
When I generate ten tranglify images to fill some details in my website I noticed that colours of them are often very similar to each other. I mean base colour of course. I'm using default 'random' values. How to make it more vary?
// magic triangles
function addTriangleTo(target) {
var dimensions = target.getClientRects()[0];
var pattern = trianglify({
cellSize: 15,
width: dimensions.width,
height: dimensions.height
}).toCanvas();
triangle = pattern.toDataURL("image/png");
target.style['background-image'] = 'url(' + triangle + ')';
target.style['opacity'] = '0.5';
}
for (var i = 1; i < 11; i++) {
imgid = 't'+i.toString()
addTriangleTo(document.getElementById(imgid));
}
qrohlf commented
The default palette is a full set of the colorbrewer scales, which includes several similar sets of colors. If you’d like to customize the palette that is used for the ‘random’ option, you can pass in your own via the palette config parameter. See the README for more info on the data format that the palette config parameter expects.