From f0d506c4461d5f3ed41b65ffe051dd2b018dac0d Mon Sep 17 00:00:00 2001 From: squidfunk Date: Mon, 24 Apr 2023 14:48:48 +0200 Subject: [PATCH] Fixed theme breaking when no palette is defined --- material/partials/header.html | 30 ++++++++-------- src/partials/header.html | 64 ++++++++++++++++++----------------- 2 files changed, 49 insertions(+), 45 deletions(-) diff --git a/material/partials/header.html b/material/partials/header.html index eafbea141..3b3c52f71 100644 --- a/material/partials/header.html +++ b/material/partials/header.html @@ -33,20 +33,22 @@ - {% if not config.theme.palette is mapping %} -
- {% for option in config.theme.palette %} - {% set scheme = option.scheme | d("default", true) %} - {% set primary = option.primary | d("indigo", true) %} - {% set accent = option.accent | d("indigo", true) %} - - {% if option.toggle %} - - {% endif %} - {% endfor %} -
+ {% if config.theme.palette %} + {% if not config.theme.palette is mapping %} +
+ {% for option in config.theme.palette %} + {% set scheme = option.scheme | d("default", true) %} + {% set primary = option.primary | d("indigo", true) %} + {% set accent = option.accent | d("indigo", true) %} + + {% if option.toggle %} + + {% endif %} + {% endfor %} +
+ {% endif %} {% endif %} {% if config.extra.alternate %}
diff --git a/src/partials/header.html b/src/partials/header.html index 85cab971f..59e4cd5b0 100644 --- a/src/partials/header.html +++ b/src/partials/header.html @@ -72,39 +72,41 @@
- {% if not config.theme.palette is mapping %} -
- {% for option in config.theme.palette %} - {% set scheme = option.scheme | d("default", true) %} - {% set primary = option.primary | d("indigo", true) %} - {% set accent = option.accent | d("indigo", true) %} - + {% for option in config.theme.palette %} + {% set scheme = option.scheme | d("default", true) %} + {% set primary = option.primary | d("indigo", true) %} + {% set accent = option.accent | d("indigo", true) %} + {% if option.toggle %} - aria-label="{{ option.toggle.name }}" - {% else %} - aria-hidden="true" + {% endif %} - type="radio" - name="__palette" - id="__palette_{{ loop.index }}" - /> - {% if option.toggle %} - - {% endif %} - {% endfor %} -
+ {% endfor %} + + {% endif %} {% endif %}