diff --git a/panel/pane/holoviews.py b/panel/pane/holoviews.py index c1b0deb55b..3dbd95fb0c 100644 --- a/panel/pane/holoviews.py +++ b/panel/pane/holoviews.py @@ -289,6 +289,8 @@ def _render(self, doc, comm, root): params = {} if self.theme is not None: params['theme'] = self.theme + elif doc.theme and getattr(doc.theme, '_json') != {'attrs': {}}: + params['theme'] = doc.theme if mode != renderer.mode: params['mode'] = mode if params: diff --git a/panel/template/base.py b/panel/template/base.py index 3200ea6756..9d4af2299a 100644 --- a/panel/template/base.py +++ b/panel/template/base.py @@ -471,9 +471,9 @@ def _init_doc(self, doc=None, comm=None, title=None, notebook=False, location=Tr def _apply_hooks(self, viewable, root): BaseTemplate._apply_hooks(viewable, root) - for hvpane in viewable.select(HoloViews): - if self.theme.bokeh_theme: - hvpane.theme = self.theme.bokeh_theme + theme = self._get_theme() + if theme and theme.bokeh_theme and root.document: + root.document.theme = theme.bokeh_theme def _get_theme(self): return self.theme.find_theme(type(self))()