# Sankey Link Hover Color

**URL:** <https://community.plotly.com/t/sankey-link-hover-color/26912>\
**Category:** plotly.js\
**Created:** [August 6, 2019, 7:55pm UTC](https://community.plotly.com/t/sankey-link-hover-color/26912 "2019-08-06T19:55:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryankinsey1](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/ryankinsey1/32/7537_2.png) [@ryankinsey1](https://community.plotly.com/u/ryankinsey1)\
**Post date:** [August 6, 2019, 7:55pm UTC](https://community.plotly.com/t/sankey-link-hover-color/26912/1 "2019-08-06T19:55:57Z")

</div>

Is it possible to change the color of the sankey link on hover or click event? Ideally the color would be completely different than the static link color in order to be more noticeable when hovered or clicked. I’m not talking about an opacity change necessarily, I would like 2 completely different colors.

The default is light gray and slightly darker gray on hover. According to the below post in 2018, the LinkHoverStyle is hardcoded to simply change the opacity of the same color when hovered. As mentioned, this is not always ideal and I think being able to have a color difference between hover and non-hovered data would be much more effective. Particularly on a sankey with many nodes where the trace can get lost for the user because the difference between light gray/color and dark gray/color is not discernible. Simply put, the slight opacity change can be a limiting factor to the visualization’s effectiveness.

> [@Changing trace colors in Sankey](https://community.plotly.com/t/changing-trace-colors-in-sankey/10691/2):
>
> Hi @butteredtoast It may be easier for users to give suggestion if you share your code. That said, have you tried something like: library(plotly) plot\_ly( type='sankey', alpha = 0.1, node = list( pad = 15, thickness = 20, line = list( color = "black", width = 0.5 ), label = c("A1", "A2", "B1", "B2", "C1", "C2"), color = 'rgba(255,0,255,0.8)' ), link = list( source = c(0,1,0,2,3,3), target = c(2,3,3,4,4,5), value = c(8,4,2,8,4,2), c…

P.S I’m using Python, if that matters at all.

---

<div class="post-metadata">

**Author:** ![Xela95](https://avatars.discourse-cdn.com/v4/letter/x/47e85d/32.png) [@Xela95](https://community.plotly.com/u/Xela95)\
**Post date:** [May 24, 2021, 10:04pm UTC](https://community.plotly.com/t/sankey-link-hover-color/26912/2 "2021-05-24T22:04:51Z")

</div>

Hi, had the same challenge here. Found the following solution :

> [@Feature request: Hover link color in Sankey graphs](https://community.plotly.com/t/feature-request-hover-link-color-in-sankey-graphs/52868/2):
>
> Hi, I agree this should be a Plotly setting when creating a Sankey diagram. However, using custom CSS in your styles.css does the work, such as : .sankey-link:hover { fill: gold !important; fill-opacity: 1 !important; } That way, you can set fill color, fill opacity, and basically any style attribute to track your links trough all the flows. Current limitations : link styling on hover only happens when hovering on a link, but not hovering a node (that should style all links outbound o…
