Formatting

This commit is contained in:
squidfunk 2022-11-12 15:08:01 +01:00
parent 9c8ee7cf94
commit a64ecac610
4 changed files with 10 additions and 18 deletions

View File

@ -81,10 +81,8 @@
{% if not palette is mapping %} {% if not palette is mapping %}
{% set palette = palette | first %} {% set palette = palette | first %}
{% endif %} {% endif %}
{% set scheme = palette.scheme | d("default", true) %} {% set scheme = palette.scheme | d("default", true) %}
{% set primary = palette.primary %} <body dir="{{ direction }}" data-md-color-scheme="{{ scheme | replace(' ', '-') }}" data-md-color-primary="{{ palette.primary | replace(' ', '-') }}" data-md-color-accent="{{ palette.accent | replace(' ', '-') }}">
{% set accent = palette.accent %}
<body dir="{{ direction }}" data-md-color-scheme="{{ scheme | replace(' ', '-') }}" data-md-color-primary="{{ primary | replace(' ', '-') }}" data-md-color-accent="{{ accent | replace(' ', '-') }}">
{% else %} {% else %}
<body dir="{{ direction }}"> <body dir="{{ direction }}">
{% endif %} {% endif %}

View File

@ -34,10 +34,8 @@
{% if not config.theme.palette is mapping %} {% if not config.theme.palette is mapping %}
<form class="md-header__option" data-md-component="palette"> <form class="md-header__option" data-md-component="palette">
{% for option in config.theme.palette %} {% for option in config.theme.palette %}
{% set scheme = option.scheme | d("default", true) %} {% set scheme = option.scheme | d("default", true) %}
{% set primary = option.primary %} <input class="md-option" data-md-color-media="{{ option.media }}" data-md-color-scheme="{{ scheme | replace(' ', '-') }}" data-md-color-primary="{{ option.primary | replace(' ', '-') }}" data-md-color-accent="{{ option.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 %}
<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 }}">
{% if option.toggle %} {% if option.toggle %}
<label class="md-header__button md-icon" title="{{ option.toggle.name }}" for="__palette_{{ loop.index0 or loop.length }}" hidden> <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" %} {% include ".icons/" ~ option.toggle.icon ~ ".svg" %}

View File

@ -159,14 +159,12 @@
{% if not palette is mapping %} {% if not palette is mapping %}
{% set palette = palette | first %} {% set palette = palette | first %}
{% endif %} {% endif %}
{% set scheme = palette.scheme | d("default", true) %} {% set scheme = palette.scheme | d("default", true) %}
{% set primary = palette.primary %}
{% set accent = palette.accent %}
<body <body
dir="{{ direction }}" dir="{{ direction }}"
data-md-color-scheme="{{ scheme | replace(' ', '-') }}" data-md-color-scheme="{{ scheme | replace(' ', '-') }}"
data-md-color-primary="{{ primary | replace(' ', '-') }}" data-md-color-primary="{{ palette.primary | replace(' ', '-') }}"
data-md-color-accent="{{ accent | replace(' ', '-') }}" data-md-color-accent="{{ palette.accent | replace(' ', '-') }}"
> >
{% else %} {% else %}
<body dir="{{ direction }}"> <body dir="{{ direction }}">

View File

@ -73,15 +73,13 @@
{% if not config.theme.palette is mapping %} {% if not config.theme.palette is mapping %}
<form class="md-header__option" data-md-component="palette"> <form class="md-header__option" data-md-component="palette">
{% for option in config.theme.palette %} {% for option in config.theme.palette %}
{% set scheme = option.scheme | d("default", true) %} {% set scheme = option.scheme | d("default", true) %}
{% set primary = option.primary %}
{% set accent = option.accent %}
<input <input
class="md-option" class="md-option"
data-md-color-media="{{ option.media }}" data-md-color-media="{{ option.media }}"
data-md-color-scheme="{{ scheme | replace(' ', '-') }}" data-md-color-scheme="{{ scheme | replace(' ', '-') }}"
data-md-color-primary="{{ primary | replace(' ', '-') }}" data-md-color-primary="{{ option.primary | replace(' ', '-') }}"
data-md-color-accent="{{ accent | replace(' ', '-') }}" data-md-color-accent="{{ option.accent | replace(' ', '-') }}"
{% if option.toggle %} {% if option.toggle %}
aria-label="{{ option.toggle.name }}" aria-label="{{ option.toggle.name }}"
{% else %} {% else %}