☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Changing the Color of HoverTool Text to Match DataSource Color Field of Current Target

Community Support
Kyle_Marcroft
Kyle_Marcroft

I am trying to figure out how to set the text color of the HoverTool tooltips text to match the color of the glyph whose source it is currently displaying information from. I have been unable to find where in the documentation the property I can use with cb_obj to set that color in some CustomJS code, or how to tap into the Source information used by the HoverTool to generate the tooltips.

BTW, in the tool tip these two choices give identical results. It appears that the hex code for the color will be shown either way:

hover.tooltips = [
("Color", "$color[swatch]:Color"),
("Color", "$color[hex, swatch]:Color")
]
⌁   Link to post
Bryan
Bryan

The basic auto-generated tooltip is not very configurable to any degree. If you want to alter the appearance, etc. you should pas a custom tooltip template:

https://docs.bokeh.org/en/latest/docs/user_guide/tools.html#custom-tooltip

I expect that means you are passing hex values to begin with. The hex value there causes color2hex to be applied, which is a no-op in that case.

⌁   Link to post
Bryan
Bryan

It is not, it is constructed programmatically by building DOM elements explicitly.

⌁   Link to post

End of archived discussion · Replies are disabled