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

@ -82,9 +82,7 @@
{% 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

@ -35,9 +35,7 @@
<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

@ -160,13 +160,11 @@
{% 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

@ -74,14 +74,12 @@
<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 %}