What is the right way to change the color of a tooltip in Bokeh python?

Viewed 1410

Objective: To learn how to change the background color of Bokeh tooltip in Python.

Below is the code that works for me, but I cannot seem to adjust the color within the tooltip (currently this produces only a white background for the tooltip/hover):

# Sometimes Bokeh is to verbose
import warnings
warnings.filterwarnings('ignore')

# Develop a histogram
from bokeh.charts import Bar, output_file, show

# Information contained within the hoover
tooltips=[
    ('Age', '@Age'),
    ('Count', '@height{0,000}')
]


colormap = {'Age':'gray'}
colors = colormap

from bokeh.palettes import brewer
#palette = brewer["Blues"][3]

# Create chart
p = Bar(data, 'Age', values='Age', title="Hep-C Age",xlabel="Age", ylabel="Number of Observations",
        agg='count',
       tooltips=tooltips, legend=False,plot_width=600, plot_height=400, 
        tools="lasso_select,box_select,tap,box_zoom,reset,save", active_drag="lasso_select",
       toolbar_location="above",color="gray",title_text_font_size='14pt',title_text_color="gray")
1 Answers

Based on Alex I successfully found a solution:

hover = HoverTool( tooltips="""

    <div style ="border-style: solid;border-width: 15px;background-color:black;">         
        <div>
            <span style="font-size: 12px; color: white;font-family:century gothic;">@height{0,000}</span>
            <span style="font-size: 12px; color: white;font-family:century gothic;"> Observations</span>
        </div>
    </div>
Related