mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-26 19:09:52 +00:00
* Node def store and settings tore * Fix initial values * Remove legacy setting listen * Fix searchbox test
31 lines
873 B
Vue
31 lines
873 B
Vue
<template>
|
|
<SideBarIcon
|
|
:icon="icon"
|
|
@click="toggleTheme"
|
|
:tooltip="$t('sideToolBar.themeToggle')"
|
|
class="comfy-vue-theme-toggle"
|
|
/>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { computed, ref } from "vue";
|
|
import SideBarIcon from "./SideBarIcon.vue";
|
|
import { useSettingStore } from "@/stores/settingStore";
|
|
|
|
const previousDarkTheme = ref("dark");
|
|
const currentTheme = computed(() =>
|
|
useSettingStore().get("Comfy.ColorPalette", "dark")
|
|
);
|
|
const isDarkMode = computed(() => currentTheme.value !== "light");
|
|
const icon = computed(() => (isDarkMode.value ? "pi pi-moon" : "pi pi-sun"));
|
|
|
|
const toggleTheme = () => {
|
|
if (isDarkMode.value) {
|
|
previousDarkTheme.value = currentTheme.value;
|
|
useSettingStore().set("Comfy.ColorPalette", "light");
|
|
} else {
|
|
useSettingStore().set("Comfy.ColorPalette", previousDarkTheme.value);
|
|
}
|
|
};
|
|
</script>
|