feat(frontend): add dark/light theme toggle with system detection

- Add ThemeToggle component (Auto / Dark / Light) to all views
- Store preference per browser and detect system preference live
  via prefers-color-scheme
- Apply theme before first render in index.html to prevent flash
- Extend CSS with light theme variables and refactor glass styles
This commit is contained in:
Tronax 2026-08-25 18:59:12 +02:00
parent cb30223fd4
commit f220d96e3b
Signed by: Tronax
SSH key fingerprint: SHA256:2pKKXDZucWvaF/GzXNz0FY53EAO1YDLN80bqS+TTz/o
11 changed files with 217 additions and 26 deletions

View file

@ -0,0 +1,30 @@
<script setup lang="ts">
import { useTheme } from '../lib/theme'
const { mode, labels, cycle } = useTheme()
const icons = { auto: '🌗', dark: '🌙', light: '☀️' } as const
</script>
<template>
<button
class="btn btn-sm theme-toggle"
type="button"
:title="`Design: ${labels[mode]} klicken zum Wechseln`"
:aria-label="`Design umschalten, aktuell ${labels[mode]}`"
@click="cycle"
>
<span aria-hidden="true">{{ icons[mode] }}</span>
<span class="tlabel">{{ labels[mode] }}</span>
</button>
</template>
<style scoped>
.tlabel {
margin-left: 7px;
}
@media (max-width: 600px) {
.tlabel {
display: none;
}
}
</style>