wannpassts/frontend/src/components/ThemeToggle.vue
Tronax f220d96e3b
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
2026-08-25 18:59:12 +02:00

30 lines
667 B
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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>