react-diagrams icon indicating copy to clipboard operation
react-diagrams copied to clipboard

Set color of a Link object

Open bastienJS opened this issue 4 years ago • 4 comments
trafficstars

const link = flatOutPort.link(buildingAreaInPort);

How can I set the color of a link object? In the sample apps I have found nothing and the link object itself has no function to set any color like the nodes have...

bastienJS avatar Dec 07 '20 13:12 bastienJS

Hmmm I believe that if you want to change the link appearance, you'll probably have to build a custom link entity.

I've done it in my project, if you want to take a look here.

renato-bohler avatar Dec 07 '20 14:12 renato-bohler

Thx I will have a look at it. I thought setting a color could be an easy link.setColor('rgb...') like your competitors do from https://github.com/wbkd/react-flow 👍

bastienJS avatar Dec 07 '20 16:12 bastienJS

Well, digging a little bit I've found out that apparently the DefaultLink has a setColor method. Never used it though, so I'm not sure if it works as intended.

But overall, I think the idea of react-diagrams is to offer a good basis where you can build upon and customize freely to your needs. That's different than any other "competitors", where you can more easily customize simple stuff, but you really can't change whatever you want.

renato-bohler avatar Dec 07 '20 16:12 renato-bohler

The setColor("#ffffff") method works great. I needed it as well and just tried it.

devlpr avatar Oct 13 '24 07:10 devlpr