I'm using Plotly to display an image (3 channels, not just a heatmap). I want to add custom information when I hover a pixel.
I managed to display the RGB values with hovertemplate and customdata, but I also would like to have the background color of the tooltip the same color as the hovered pixel.
import numpy as np
import plotly.graph_objects as go
size = 5
img = np.random.random((size, size, 3)) * 255
fig = go.Figure(
go.Image(
z=img,
customdata=img.astype(int),
hovertemplate='<br>'.join([
"R: %{customdata[0]}",
"G: %{customdata[1]}",
"B: %{customdata[2]}"
]),
name=''
)
)
fig.show('browser')
Is there a way to set the background (or the text) color of the tooltip the same one as the hovered pixel?

