Make color theme switch more flexible

This commit is contained in:
2026-05-17 17:33:22 +02:00
parent 170f188435
commit 5d98f27b6b
5 changed files with 109 additions and 55 deletions
+7 -3
View File
@@ -17,14 +17,18 @@ limitations under the License.
<script setup>
import Navbar from './features/nav/components/Navbar.vue';
import Footer from './features/footer/components/Footer.vue';
import { useColorTheme } from './features/colorTheme/composables/useColorTheme';
import { ref, provide, watch } from 'vue';
const isDark = ref(localStorage.getItem('theme') === 'dark');
provide('isDark', isDark);
const { getColorTheme, updateColorTheme, appHasDarkClass } = useColorTheme();
const colorTheme = ref(getColorTheme());
provide('colorTheme', colorTheme);
watch(colorTheme, val => updateColorTheme(val))
</script>
<template>
<div :class="{ dark: isDark }" class="app-wrapper">
<div :class="{ dark: appHasDarkClass(colorTheme) }" class="app-wrapper">
<Navbar />
<div class="main-content">