mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-09 01:20:09 +00:00
Extract theme toggle as command (#1161)
* Extract theme toggle as command * nit
This commit is contained in:
@@ -436,6 +436,27 @@ export const useCommandStore = defineStore('command', () => {
|
||||
node.collapse()
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'Comfy.ToggleTheme',
|
||||
icon: 'pi pi-moon',
|
||||
label: 'Toggle Theme',
|
||||
versionAdded: '1.3.12',
|
||||
function: (() => {
|
||||
let previousDarkTheme: string = 'dark'
|
||||
|
||||
// Official light theme is the only light theme supported now.
|
||||
const isDarkMode = (themeId: string) => themeId !== 'light'
|
||||
return () => {
|
||||
const currentTheme = settingStore.get('Comfy.ColorPalette')
|
||||
if (isDarkMode(currentTheme)) {
|
||||
previousDarkTheme = currentTheme
|
||||
settingStore.set('Comfy.ColorPalette', 'light')
|
||||
} else {
|
||||
settingStore.set('Comfy.ColorPalette', previousDarkTheme)
|
||||
}
|
||||
}
|
||||
})()
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user