1
0
Fork 0
jinjax/docs/theme/ThemeSwitch.jinja
Daniel Baumann 76fe8c2886
Merging upstream version 0.46.
Signed-off-by: Daniel Baumann <daniel@debian.org>
2025-02-05 18:42:39 +01:00

36 lines
1.1 KiB
Django/Jinja

{#def text=true #}
<button {{ attrs.render(
class="cd-theme-switch",
data_component="ThemeSwitch",
title="Toggle light & dark mode",
aria_label="auto",
aria_live="polite",
) }}>
<svg
class="sun-and-moon"
aria-hidden="true"
stroke-linecap="round"
viewBox="0 0 24 24"
>
<circle class="sun" cx="12" cy="12" r="6" mask="url(#moon-mask)"></circle>
<g class="sun-beams">
<line x1="12" y1="1" x2="12" y2="3" />
<line x1="12" y1="21" x2="12" y2="23" />
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64" />
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78" />
<line x1="1" y1="12" x2="3" y2="12" />
<line x1="21" y1="12" x2="23" y2="12" />
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36" />
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22" />
</g>
<mask class="moon" id="moon-mask">
<rect x="0" y="0" width="100%" height="100%" fill="white" />
<circle cx="24" cy="10" r="6"></circle>
</mask>
</svg>
{% if text -%}
<span class="light-text">Light</span>
<span class="dark-text">Dark</span>
{%- endif %}
</button>