jquery.flowchart
jquery.flowchart copied to clipboard
How to Generate link with random color
I have this function to generate a random color.
function getRandomDarkRolor() { var letters = '012345'.split(''); var color = '#'; color += letters[Math.round(Math.random() * 5)]; letters = '0123456789ABCDEF'.split(''); for (var i = 0; i < 5; i++) { color += letters[Math.round(Math.random() * 15)]; } return color; }
Is there a way to: everytime a link is created, change it's color??
Did you try to use the function onLinkCreate
and change the color using the linkData parameter ?
@Geaper i have find out a way to generate random color everytime you create link.
after_change: function (changeType) { var self = this; if (changeType === 'link_create') { self.$flowChart.flowchart('setLinkMainColor', self.link_id, self.bgcolor); } },