Add hover colour to native window controls

This commit is contained in:
filtered
2025-01-11 18:02:55 +11:00
parent 504c661859
commit 9d108b80b9

View File

@@ -46,6 +46,7 @@ import { useColorPaletteStore } from '@/stores/workspace/colorPaletteStore'
import { useSidebarTabStore } from '@/stores/workspace/sidebarTabStore'
import { useWorkspaceStore } from '@/stores/workspaceStore'
import { StatusWsMessageStatus } from '@/types/apiTypes'
import { electronAPI, isElectron } from '@/utils/envUtil'
setupAutoQueueHandler()
@@ -64,6 +65,25 @@ watch(
} else {
document.body.classList.add(DARK_THEME_CLASS)
}
// Native window control theme
if (isElectron()) {
const cssVars = newTheme.colors.comfy_base
// Allow OS to set matching hover colour
const color = setZeroAlpha(cssVars['comfy-menu-bg'])
const symbolColor = cssVars['input-text']
electronAPI().changeTheme({ color, symbolColor })
}
function setZeroAlpha(color: string) {
if (!color.startsWith('#')) return color
if (color.length === 4) {
const [_, r, g, b] = color
return `#${r}${r}${g}${g}${b}${b}00`
}
return `#${color.substring(1, 7)}00`
}
},
{ immediate: true }
)