# Change node color

**URL:** <https://talk.observablehq.com/t/change-node-color/4712>\
**Category:** Help\
**Created:** [February 26, 2021, 12:48am UTC](https://talk.observablehq.com/t/change-node-color/4712 "2021-02-26T00:48:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![brunurb](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/brunurb/32/4450_2.png) [@brunurb](https://talk.observablehq.com/u/brunurb)\
**Post date:** [February 26, 2021, 12:48am UTC](https://talk.observablehq.com/t/change-node-color/4712/1 "2021-02-26T00:48:48Z")

</div>

How could I change the node color in [this sankey diagram](https://observablehq.com/@brunurb/flow-o-matic-sankey-silvia)

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

 ![flow-o-matic](https://canada1.discourse-cdn.com/flex030/uploads/observablehq/original/2X/a/a592a4c92bddc9d0f5edc474b76d99e6debd9ec3.png)

---

<div class="post-metadata">

**Author:** ![hellonearthis](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/hellonearthis/32/3935_2.png) [@hellonearthis](https://talk.observablehq.com/u/hellonearthis)\
**Post date:** [February 26, 2021, 5:53am UTC](https://talk.observablehq.com/t/change-node-color/4712/2 "2021-02-26T05:53:14Z")

</div>

I looks like the color is defined in the data cell

```auto
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.

---

<div class="post-metadata">

**Author:** ![brunurb](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/brunurb/32/4450_2.png) [@brunurb](https://talk.observablehq.com/u/brunurb)\
**Post date:** [February 26, 2021, 9:19pm UTC](https://talk.observablehq.com/t/change-node-color/4712/3 "2021-02-26T21:19:16Z")

</div>

Thank you for your reply, [hellonearthis](https://talk.observablehq.com/u/hellonearthis)  
It worked  
All the best to you
