Change node color

How could I change the node color in this sankey diagram

I wanted the two bottom central nodes to be the same color as the previous link color (in this case the bottom node red and the one above it orange).
Noob here, thanks in advance for your help.
Example

I looks like the color is defined in the data cell

data = {
  const links = d3.csvParseRows(source, ([source, target, value, linkColor = color]) => (source && target ? {source, target, value: !value || isNaN(value = +value) ? 1 : value, color: linkColor} : null));
  const nodeByName = new Map;
  console.log(links)
  for (const link of links) {
    if (!nodeByName.has(link.source)) nodeByName.set(link.source, {name: link.source});
    if (!nodeByName.has(link.target)) nodeByName.set(link.target, {name: link.target});
  }
  return {nodes: Array.from(nodeByName.values()), links};
}

So adding rules there would be one way to address the colour.

Of changing the colours in the source cell.

1 Like

Thank you for your reply, hellonearthis
It worked
All the best to you

1 Like