From d83ae03b2a43072fafcc695a2b82d49aed82bd44 Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Mon, 26 Jan 2026 10:48:23 +0100 Subject: [PATCH 1/2] Ensure configured Design overrides Template default --- panel/template/base.py | 3 +++ panel/tests/template/test_base.py | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/panel/template/base.py b/panel/template/base.py index 14f7250a7df..805c49ad314 100644 --- a/panel/template/base.py +++ b/panel/template/base.py @@ -44,6 +44,7 @@ from ..theme.base import ( THEMES, DefaultTheme, Design, Theme, ) +from ..theme.native import Native from ..util import isurl from ..viewable import ( MimeRenderMixin, Renderable, ServableMixin, Viewable, @@ -119,6 +120,8 @@ def __init__( } self._render_items: dict[str, tuple[Renderable, list[str]]] = {} self._render_variables: dict[str, Any] = {} + if 'design' not in params and self.param.design.default in (None, Design, Native): + params['design'] = config.design super().__init__(**{ p: v for p, v in params.items() if p not in _base_config.param or p == 'name' }) diff --git a/panel/tests/template/test_base.py b/panel/tests/template/test_base.py index a2435c94daa..4296459ea65 100644 --- a/panel/tests/template/test_base.py +++ b/panel/tests/template/test_base.py @@ -4,6 +4,7 @@ from panel.io.notifications import NotificationArea from panel.io.state import set_curdoc, state from panel.template import VanillaTemplate +from panel.theme import Material from panel.widgets import Button @@ -34,6 +35,13 @@ def test_notification_explicit(document): assert state.notifications is tmpl.notifications +def test_template_inherits_configured_design(): + with config.set(design=Material): + tmpl = VanillaTemplate() + + assert tmpl.design is Material + + def test_template_pass_config_params_constructor(document): custom_config = { 'raw_css': ['html { background-color: purple; }'], From c2f7eb3f3d8f2578fe8a671aeb701f5bfa13e1ef Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Mon, 26 Jan 2026 12:01:30 +0100 Subject: [PATCH 2/2] Update panel/template/base.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- panel/template/base.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/panel/template/base.py b/panel/template/base.py index 805c49ad314..8d72d1a73ad 100644 --- a/panel/template/base.py +++ b/panel/template/base.py @@ -120,7 +120,11 @@ def __init__( } self._render_items: dict[str, tuple[Renderable, list[str]]] = {} self._render_variables: dict[str, Any] = {} - if 'design' not in params and self.param.design.default in (None, Design, Native): + if ( + 'design' not in params + and self.param.design.default in (None, Design, Native) + and config.design is not None + ): params['design'] = config.design super().__init__(**{ p: v for p, v in params.items() if p not in _base_config.param or p == 'name'