feat(reader): add light/dark mode toggle for reading themes

Add explicit light/dark mode toggle switch to the reading theme settings.
The reading mode defaults based on the chrome theme (dark chrome themes
like tokyo-night default to dark reading mode).

- Add readingMode property to readerShell Alpine component
- Add toggleReadingMode() method that toggles dark class on body
- Add detectChromeDarkMode() to infer default from chrome theme
- Update applyTheme() to add/remove dark class and persist reading_mode
- Add toggle switch UI in settings panel (blue pill style, next to
  Reading Theme heading)
- Add reading_mode to default settings in settings-manager
This commit is contained in:
2026-04-19 20:05:42 -04:00
parent b983f2cd2e
commit 48a8716a25
5 changed files with 53 additions and 10 deletions
+15 -1
View File
@@ -186,7 +186,21 @@ templ ReaderSettingsPanel() {
</div>
<!-- Reading Theme (reflowable only) -->
<div class="mb-6" x-show="!isFixedLayout">
<h3 class="font-semibold mb-2">Reading Theme</h3>
<div class="flex items-center justify-between mb-2">
<h3 class="font-semibold">Reading Theme</h3>
<button
@click="toggleReadingMode()"
class="relative w-12 h-6 rounded-full transition-colors duration-200"
:class="readingMode === 'dark' ? 'bg-blue-500' : 'bg-gray-400'"
type="button"
:aria-label="readingMode === 'dark' ? 'Switch to light mode' : 'Switch to dark mode'"
>
<span
class="absolute top-0.5 left-0.5 w-5 h-5 bg-white rounded-full shadow transition-transform duration-200"
:class="readingMode === 'dark' ? 'translate-x-6' : 'translate-x-0'"
></span>
</button>
</div>
<label class="block mb-2">
<select name="reading_theme" x-model="readingTheme" @change="applyTheme()" class="w-full mt-1 px-3 py-2 rounded border">
<optgroup label="📖 Classic Reading">