jquery.flowchart icon indicating copy to clipboard operation
jquery.flowchart copied to clipboard

How to Generate link with random color

Open Geaper opened this issue 6 years ago • 2 comments

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??

Geaper avatar Apr 26 '18 13:04 Geaper

Did you try to use the function onLinkCreate and change the color using the linkData parameter ?

sdrdis avatar May 03 '18 09:05 sdrdis

@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); } },

the-wild-bot avatar May 18 '18 11:05 the-wild-bot