mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-30 18:24:35 +01:00
Fixed theme breaking when no palette is defined
This commit is contained in:
parent
0028518f1a
commit
f0d506c446
@ -33,20 +33,22 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% if not config.theme.palette is mapping %}
|
{% if config.theme.palette %}
|
||||||
<form class="md-header__option" data-md-component="palette">
|
{% if not config.theme.palette is mapping %}
|
||||||
{% for option in config.theme.palette %}
|
<form class="md-header__option" data-md-component="palette">
|
||||||
{% set scheme = option.scheme | d("default", true) %}
|
{% for option in config.theme.palette %}
|
||||||
{% set primary = option.primary | d("indigo", true) %}
|
{% set scheme = option.scheme | d("default", true) %}
|
||||||
{% set accent = option.accent | d("indigo", true) %}
|
{% set primary = option.primary | d("indigo", true) %}
|
||||||
<input class="md-option" data-md-color-media="{{ option.media }}" data-md-color-scheme="{{ scheme | replace(' ', '-') }}" data-md-color-primary="{{ primary | replace(' ', '-') }}" data-md-color-accent="{{ accent | replace(' ', '-') }}" {% if option.toggle %} aria-label="{{ option.toggle.name }}" {% else %} aria-hidden="true" {% endif %} type="radio" name="__palette" id="__palette_{{ loop.index }}">
|
{% set accent = option.accent | d("indigo", true) %}
|
||||||
{% if option.toggle %}
|
<input class="md-option" data-md-color-media="{{ option.media }}" data-md-color-scheme="{{ scheme | replace(' ', '-') }}" data-md-color-primary="{{ primary | replace(' ', '-') }}" data-md-color-accent="{{ accent | replace(' ', '-') }}" {% if option.toggle %} aria-label="{{ option.toggle.name }}" {% else %} aria-hidden="true" {% endif %} type="radio" name="__palette" id="__palette_{{ loop.index }}">
|
||||||
<label class="md-header__button md-icon" title="{{ option.toggle.name }}" for="__palette_{{ loop.index0 or loop.length }}" hidden>
|
{% if option.toggle %}
|
||||||
{% include ".icons/" ~ option.toggle.icon ~ ".svg" %}
|
<label class="md-header__button md-icon" title="{{ option.toggle.name }}" for="__palette_{{ loop.index0 or loop.length }}" hidden>
|
||||||
</label>
|
{% include ".icons/" ~ option.toggle.icon ~ ".svg" %}
|
||||||
{% endif %}
|
</label>
|
||||||
{% endfor %}
|
{% endif %}
|
||||||
</form>
|
{% endfor %}
|
||||||
|
</form>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if config.extra.alternate %}
|
{% if config.extra.alternate %}
|
||||||
<div class="md-header__option">
|
<div class="md-header__option">
|
||||||
|
@ -72,39 +72,41 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Color palette -->
|
<!-- Color palette -->
|
||||||
{% if not config.theme.palette is mapping %}
|
{% if config.theme.palette %}
|
||||||
<form class="md-header__option" data-md-component="palette">
|
{% if not config.theme.palette is mapping %}
|
||||||
{% for option in config.theme.palette %}
|
<form class="md-header__option" data-md-component="palette">
|
||||||
{% set scheme = option.scheme | d("default", true) %}
|
{% for option in config.theme.palette %}
|
||||||
{% set primary = option.primary | d("indigo", true) %}
|
{% set scheme = option.scheme | d("default", true) %}
|
||||||
{% set accent = option.accent | d("indigo", true) %}
|
{% set primary = option.primary | d("indigo", true) %}
|
||||||
<input
|
{% set accent = option.accent | d("indigo", true) %}
|
||||||
class="md-option"
|
<input
|
||||||
data-md-color-media="{{ option.media }}"
|
class="md-option"
|
||||||
data-md-color-scheme="{{ scheme | replace(' ', '-') }}"
|
data-md-color-media="{{ option.media }}"
|
||||||
data-md-color-primary="{{ primary | replace(' ', '-') }}"
|
data-md-color-scheme="{{ scheme | replace(' ', '-') }}"
|
||||||
data-md-color-accent="{{ accent | replace(' ', '-') }}"
|
data-md-color-primary="{{ primary | replace(' ', '-') }}"
|
||||||
|
data-md-color-accent="{{ accent | replace(' ', '-') }}"
|
||||||
|
{% if option.toggle %}
|
||||||
|
aria-label="{{ option.toggle.name }}"
|
||||||
|
{% else %}
|
||||||
|
aria-hidden="true"
|
||||||
|
{% endif %}
|
||||||
|
type="radio"
|
||||||
|
name="__palette"
|
||||||
|
id="__palette_{{ loop.index }}"
|
||||||
|
/>
|
||||||
{% if option.toggle %}
|
{% if option.toggle %}
|
||||||
aria-label="{{ option.toggle.name }}"
|
<label
|
||||||
{% else %}
|
class="md-header__button md-icon"
|
||||||
aria-hidden="true"
|
title="{{ option.toggle.name }}"
|
||||||
|
for="__palette_{{ loop.index0 or loop.length }}"
|
||||||
|
hidden
|
||||||
|
>
|
||||||
|
{% include ".icons/" ~ option.toggle.icon ~ ".svg" %}
|
||||||
|
</label>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
type="radio"
|
{% endfor %}
|
||||||
name="__palette"
|
</form>
|
||||||
id="__palette_{{ loop.index }}"
|
{% endif %}
|
||||||
/>
|
|
||||||
{% if option.toggle %}
|
|
||||||
<label
|
|
||||||
class="md-header__button md-icon"
|
|
||||||
title="{{ option.toggle.name }}"
|
|
||||||
for="__palette_{{ loop.index0 or loop.length }}"
|
|
||||||
hidden
|
|
||||||
>
|
|
||||||
{% include ".icons/" ~ option.toggle.icon ~ ".svg" %}
|
|
||||||
</label>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</form>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- Site language selector -->
|
<!-- Site language selector -->
|
||||||
|
Loading…
Reference in New Issue
Block a user