Skip to content

Commit

Permalink
[Desktop] Set window action buttons style (#2214)
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei authored Jan 10, 2025
1 parent cb265fb commit 04c2300
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/components/topbar/TopMenubar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import WorkflowTabs from '@/components/topbar/WorkflowTabs.vue'
import { app } from '@/scripts/app'
import { useSettingStore } from '@/stores/settingStore'
import { useWorkspaceStore } from '@/stores/workspaceStore'
import { showNativeMenu } from '@/utils/envUtil'
import { electronAPI, isElectron, showNativeMenu } from '@/utils/envUtil'
const workspaceState = useWorkspaceStore()
const settingStore = useSettingStore()
Expand Down Expand Up @@ -77,6 +77,14 @@ eventBus.on((event: string, payload: any) => {
isDroppable.value = payload.isOverlapping && payload.isDragging
}
})
onMounted(() => {
if (isElectron()) {
electronAPI().changeTheme({
height: topMenuRef.value.getBoundingClientRect().height
})
}
})
</script>

<style scoped>
Expand Down
8 changes: 8 additions & 0 deletions src/views/GraphView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -64,6 +65,13 @@ watch(
} else {
document.body.classList.add(DARK_THEME_CLASS)
}
if (isElectron()) {
electronAPI().changeTheme({
color: 'rgba(0, 0, 0, 0)',
symbolColor: newTheme.colors.comfy_base['input-text']
})
}
},
{ immediate: true }
)
Expand Down
20 changes: 20 additions & 0 deletions src/views/templates/BaseViewTemplate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
</template>

<script setup lang="ts">
import { onMounted } from 'vue'
import { electronAPI, isElectron } from '@/utils/envUtil'
const props = withDefaults(
defineProps<{
dark: boolean
Expand All @@ -20,4 +24,20 @@ const props = withDefaults(
dark: false
}
)
const darkTheme = {
color: 'rgba(0, 0, 0, 0)',
symbolColor: '#d4d4d4'
}
const lightTheme = {
color: 'rgba(0, 0, 0, 0)',
symbolColor: '#171717'
}
onMounted(() => {
if (isElectron()) {
electronAPI().changeTheme(props.dark ? darkTheme : lightTheme)
}
})
</script>
3 changes: 2 additions & 1 deletion vite.electron.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ const mockElectronAPI: Plugin = {
},
getElectronVersion: () => Promise.resolve('1.0.0'),
getComfyUIVersion: () => '9.9.9',
getPlatform: () => 'win32'
getPlatform: () => 'win32',
changeTheme: () => {}
};`
}
]
Expand Down

0 comments on commit 04c2300

Please sign in to comment.