Add selector for site theme

This commit is contained in:
TheThomaas 2023-06-18 21:57:04 +02:00
parent f68060aed5
commit aabd31ff90
3 changed files with 36 additions and 30 deletions

View file

@ -12,6 +12,7 @@ module.exports = {
title: "SuperMinimalCSS",
description: "Superminimal Superminimal",
lang: "fr",
theme: "auto", // "light", "dark" or "auto"
feed: "feed.xml",
url: "http://localhost:8080"
}

View file

@ -53,9 +53,12 @@
<link rel="icon" href="/images/meta/favicon.ico" sizes="any">
<link rel="icon" href="/images/meta/favicon.svg" type="image/svg+xml">
{% if site.theme == "auto" %}
<meta name="color-scheme" content="light dark">
<script>{% include "js/theme-toggle.js" %}</script>
{% else %}
<meta name="color-scheme" content={{site.theme}}>
{% endif %}
<style>
{% fetch "https://cdn.jsdelivr.net/npm/theme-toggles@4.10.1/css/around.min.css", "css" %}

View file

@ -1,3 +1,4 @@
{% if site.theme == "auto" %}
<button
class="theme-toggle"
type="button"
@ -29,3 +30,4 @@
</g>
</svg>
</button>
{% endif %}