diff options
Diffstat (limited to 'docs/theme/ThemeSwitch.jinja')
-rw-r--r-- | docs/theme/ThemeSwitch.jinja | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/docs/theme/ThemeSwitch.jinja b/docs/theme/ThemeSwitch.jinja new file mode 100644 index 0000000..3543b73 --- /dev/null +++ b/docs/theme/ThemeSwitch.jinja @@ -0,0 +1,36 @@ +{#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> |