css = '''
.widget-box {
background: #f02253;
}
'''
pn.extension(raw_css=[css])
There is not currently any API to inject CSS styles in to Bokeh output (only to set CSS classes). Two possibilities:
-
Some folks have embedded
<style>
tags in BokehDiv
objects, which seems can work at least in some situations -
Add stylesheets to a custom Jinja template, and use the various
bokeh.embed
APIs to place plots, etc in the template.
Seems I have to use Jinja template then.
BTW
Does it exist any method/function to update the whole website when any change (i.e. in css) during app execution is made? similar to curdoc().add_periodic_callback
Bokeh does not monitor CSS for changes. Presumably you could make something work yourself with a MutationObserver (but I haven’t every tried so all I can do is suggest the possibility).