holoviz / panel

Panel: The powerful data exploration & web app framework for Python
https://panel.holoviz.org
BSD 3-Clause "New" or "Revised" License
4.78k stars 518 forks source link

Themes in Bokeh pane are not working #6421

Open ahuang11 opened 8 months ago

ahuang11 commented 8 months ago
from bokeh.themes import Theme
from bokeh.plotting import figure
from bokeh.io import curdoc
from yaml import safe_load
import panel as pn

pn.extension()

theme_json = safe_load(
"""
attrs:
  figure:
    background_fill_color: red
    background_fill_alpha: 1.0
    border_fill_color: red
    border_fill_alpha: 1.0
    outline_line_color: black
    outline_line_alpha: 1.0
    outline_line_width: 2
    height: 400
    width: 800
"""
)

x = [1, 2, 3, 4, 5]
y = [6, 7, 2, 4, 5]
bokeh_obj = figure(title="dark_minimal", width=300, height=300)
bokeh_obj.line(x, y)

pn.pane.Bokeh(bokeh_obj, theme="dark_minimal")

The docs also doesn't seem to show it working: https://panel.holoviz.org/reference/panes/Bokeh.html

image
xavArtley commented 1 month ago

Add the same issue, outside a notebook I use:

pn.state.curdoc.theme = DARK_MINIMAL