I would like to have stylized tooltips (specifically, background color) upon hovering on a scatterplot’s points. The plot is rendered in the browser. It’s straightforward to get the tooltips with HoverTool, but I cannot stylize the tooltips the way I wanted. I tried customizing the tooltip by setting the tooltips
parameter to something like
<div class="custom-tooltip">
<h4 style="margin: 0; color: green;">ciaoooo</h4>
<div style="color: green;"><strong>Value:</strong>gneee</div>
</div>
<div style="background-color: black; padding: 5px; border-radius: 5px;">
<div>
<span style="font-size: 12px; font-weight: bold; color: white">@time{{%F %T}}</span>
</div>
<div>
<span style="font-size: 12px; color: white">Value: @value</span>
</div>
</div>
Which indeed creates a black box in the tooltip, but the black box is surrounded by the larger “default” white box. It seems no matter what I do, the changes only affect what’s inside the “default” box, not the box itself.
By looking at the bokeh.js file that is loaded in the html, I found that style defaults for the hover tooltip are set there:
r.default = ':host{--tooltip-border:#e5e5e5;--tooltip-color:white; ...
I confirmed that a modified js file with --tooltip-color:black
changes the background of the tooltip to black.
Is it possible to change these style parameters upon creation of the plot? I am using bokeh 3.5.2.