From 783f7a236050d1d32c63fa32adb1f32dcb4b5886 Mon Sep 17 00:00:00 2001 From: Pihkaal Date: Sun, 13 Oct 2024 01:04:50 +0200 Subject: [PATCH] feat(ui): theme switch button --- app.vue | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/app.vue b/app.vue index f0d369e..a11997e 100644 --- a/app.vue +++ b/app.vue @@ -117,6 +117,16 @@ const upperCase = (str: string) => str.toUpperCase(); const arrayToUnion = (array: string[]) => array.map((x) => `"${x}"`).join(" | "); + +const colorMode = useColorMode(); +const isDark = computed({ + get() { + return colorMode.value === "dark"; + }, + set() { + colorMode.preference = colorMode.value === "dark" ? "light" : "dark"; + }, +});