Something went wrong. Try again.
A free, open-source, self-hosted place to write a novel.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960<script lang="ts"> import { getScheme, setScheme } from '#lib/preferences.svelte.ts';
const safe = $derived(getScheme() === 'safe-mode');
/* * The icons are decorative, so the accessible name states the mode on show * and the title names the next action. */ const words = $derived( safe ? { title: 'Switch to the dark theme' } : { title: 'Switch to Safe Mode (light)' } );
function toggle() { setScheme(safe ? 'dark' : 'safe-mode'); }</script>
<button type="button" class="pref-switch tap-area" onclick={toggle} aria-pressed={safe} aria-label={`Colour mode: ${safe ? 'Safe Mode' : 'Dark'}`} title={words.title}> <span class="ends" aria-hidden="true"> <svg class="end" class:lit={!safe} viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" > <path d="M12.8 10.2A5.4 5.4 0 0 1 5.8 3.2a5.4 5.4 0 1 0 7 7Z" /> </svg> <span class="track"><span class="thumb"></span></span> <svg class="end" class:lit={safe} viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" > <circle cx="8" cy="8" r="2.6" /> <path d="M8 1v1.4M8 13.6V15M1 8h1.4M13.6 8H15M3 3l1 1M12 12l1 1M13 3l-1 1M4 12l-1 1" /> </svg> </span></button>