mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-23 14:16:00 +00:00
## Summary Small updates to the UI to make it more visually distinct from the graph nodes and improving the login button ## Changes - **What**: - Improve theme support with dynamic colors - Standardize surface colors/borders - Add shadows to all floating UI elements - Change side toolbar to be docked by default - Decrease side toolbar width - Change login button to icon only - Update C button to be more distinctive ## Review Focus - Theme tokens, I am not sure what the overall plan for how these tokens will be supported for custom user palettes. I've implemented a method where default variables are chosen that look nice over all existing themes, but they can be overridden. ## Screenshots Dark theme updated color <img width="958" height="615" alt="image" src="https://github.com/user-attachments/assets/a2c540cf-6c05-4ad3-996b-8b7b80df8d2d" /> Themed & updated menu button (active vs hover vs default) <img width="58" height="338" alt="github" src="https://github.com/user-attachments/assets/90244ee2-d5ee-4b26-9d99-f4b8439aa372" /><img width="58" height="338" alt="nord" src="https://github.com/user-attachments/assets/053e8e7b-d639-4b72-92d2-ec7e2167aab8" /><img width="58" height="338" alt="arc" src="https://github.com/user-attachments/assets/3caeb07b-d41b-4d88-83b4-ef8d45d4e5a6" /><img width="58" height="338" alt="solarized" src="https://github.com/user-attachments/assets/6ebf6afb-ec3a-436b-90eb-bda40be1c79f" /><img width="58" height="338" alt="light" src="https://github.com/user-attachments/assets/fbb7f96a-b722-40c5-86fa-a0732e166972" /><img width="58" height="338" alt="dark" src="https://github.com/user-attachments/assets/5459208b-9256-4c55-9373-169e9cd9f09a" /> With labels <img width="58" height="394" alt="labels" src="https://github.com/user-attachments/assets/f97ee354-35cd-42b8-896f-57ac39644c1d" /> Logged out (only visible on desktop) <img width="323" height="48" alt="logged out" src="https://github.com/user-attachments/assets/75b71420-0c1b-446f-8cdd-43c68674d346" /> Logged in <img width="355" height="48" alt="logged in" src="https://github.com/user-attachments/assets/324fd133-a793-49dd-844a-f93dd5d1effb" /> ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6381-UI-color-updates-tweaks-29b6d73d3650816384d2ef5617a776a0) by [Unito](https://www.unito.io) --------- Co-authored-by: GitHub Action <action@github.com> Co-authored-by: github-actions <github-actions@github.com>
248 lines
7.3 KiB
Vue
248 lines
7.3 KiB
Vue
<template>
|
|
<div>
|
|
<ZoomControlsModal :visible="isModalVisible" @close="hideModal" />
|
|
|
|
<!-- Backdrop -->
|
|
<div
|
|
v-if="hasActivePopup"
|
|
class="fixed inset-0 z-1200"
|
|
@click="hideModal"
|
|
></div>
|
|
|
|
<ButtonGroup
|
|
class="absolute right-0 bottom-0 z-[1200] flex-row gap-1 border-[1px] border-[var(--interface-stroke)] bg-interface-panel-surface p-2"
|
|
:style="{
|
|
...stringifiedMinimapStyles.buttonGroupStyles
|
|
}"
|
|
@wheel="canvasInteractions.handleWheel"
|
|
>
|
|
<CanvasModeSelector
|
|
:button-styles="stringifiedMinimapStyles.buttonStyles"
|
|
/>
|
|
|
|
<div class="h-[27px] w-[1px] self-center bg-node-divider" />
|
|
|
|
<Button
|
|
v-tooltip.top="fitViewTooltip"
|
|
severity="secondary"
|
|
icon="pi pi-expand"
|
|
:aria-label="fitViewTooltip"
|
|
:style="stringifiedMinimapStyles.buttonStyles"
|
|
class="h-8 w-8 bg-interface-panel-surface p-0 hover:bg-button-hover-surface!"
|
|
@click="() => commandStore.execute('Comfy.Canvas.FitView')"
|
|
>
|
|
<template #icon>
|
|
<i class="icon-[lucide--focus] h-4 w-4" />
|
|
</template>
|
|
</Button>
|
|
|
|
<Button
|
|
ref="zoomButton"
|
|
v-tooltip.top="t('zoomControls.label')"
|
|
severity="secondary"
|
|
:label="t('zoomControls.label')"
|
|
:class="zoomButtonClass"
|
|
:aria-label="t('zoomControls.label')"
|
|
data-testid="zoom-controls-button"
|
|
:style="stringifiedMinimapStyles.buttonStyles"
|
|
@click="toggleModal"
|
|
>
|
|
<span class="inline-flex items-center gap-1 px-2 text-xs">
|
|
<span>{{ canvasStore.appScalePercentage }}%</span>
|
|
<i class="icon-[lucide--chevron-down] h-4 w-4" />
|
|
</span>
|
|
</Button>
|
|
|
|
<div class="h-[27px] w-[1px] self-center bg-node-divider" />
|
|
|
|
<Button
|
|
ref="minimapButton"
|
|
v-tooltip.top="minimapTooltip"
|
|
severity="secondary"
|
|
:aria-label="minimapTooltip"
|
|
data-testid="toggle-minimap-button"
|
|
:style="stringifiedMinimapStyles.buttonStyles"
|
|
:class="minimapButtonClass"
|
|
@click="onMinimapToggleClick"
|
|
>
|
|
<template #icon>
|
|
<i class="icon-[lucide--map] h-4 w-4" />
|
|
</template>
|
|
</Button>
|
|
|
|
<Button
|
|
v-tooltip.top="{
|
|
value: linkVisibilityTooltip,
|
|
pt: {
|
|
root: {
|
|
style: 'z-index: 2; transform: translateY(-20px);'
|
|
}
|
|
}
|
|
}"
|
|
severity="secondary"
|
|
:class="linkVisibleClass"
|
|
:aria-label="linkVisibilityAriaLabel"
|
|
data-testid="toggle-link-visibility-button"
|
|
:style="stringifiedMinimapStyles.buttonStyles"
|
|
@click="onLinkVisibilityToggleClick"
|
|
>
|
|
<template #icon>
|
|
<i class="icon-[lucide--route-off] h-4 w-4" />
|
|
</template>
|
|
</Button>
|
|
</ButtonGroup>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import Button from 'primevue/button'
|
|
import ButtonGroup from 'primevue/buttongroup'
|
|
import { computed, onBeforeUnmount, onMounted } from 'vue'
|
|
import { useI18n } from 'vue-i18n'
|
|
|
|
import { useZoomControls } from '@/composables/useZoomControls'
|
|
import { LiteGraph } from '@/lib/litegraph/src/litegraph'
|
|
import { useSettingStore } from '@/platform/settings/settingStore'
|
|
import { useTelemetry } from '@/platform/telemetry'
|
|
import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
|
|
import { useCanvasInteractions } from '@/renderer/core/canvas/useCanvasInteractions'
|
|
import { useMinimap } from '@/renderer/extensions/minimap/composables/useMinimap'
|
|
import { useCommandStore } from '@/stores/commandStore'
|
|
|
|
import CanvasModeSelector from './CanvasModeSelector.vue'
|
|
import ZoomControlsModal from './modals/ZoomControlsModal.vue'
|
|
|
|
const { t } = useI18n()
|
|
const commandStore = useCommandStore()
|
|
const { formatKeySequence } = useCommandStore()
|
|
const canvasStore = useCanvasStore()
|
|
const settingStore = useSettingStore()
|
|
const canvasInteractions = useCanvasInteractions()
|
|
const minimap = useMinimap()
|
|
|
|
const { isModalVisible, toggleModal, hideModal, hasActivePopup } =
|
|
useZoomControls()
|
|
|
|
const stringifiedMinimapStyles = computed(() => {
|
|
const buttonGroupKeys = ['borderRadius']
|
|
const buttonKeys = ['borderRadius']
|
|
const additionalButtonStyles = {
|
|
border: 'none'
|
|
}
|
|
|
|
const containerStyles = minimap.containerStyles.value
|
|
|
|
const buttonStyles = {
|
|
...Object.fromEntries(
|
|
Object.entries(containerStyles).filter(([key]) =>
|
|
buttonKeys.includes(key)
|
|
)
|
|
),
|
|
...additionalButtonStyles
|
|
}
|
|
const buttonGroupStyles = Object.entries(containerStyles)
|
|
.filter(([key]) => buttonGroupKeys.includes(key))
|
|
.reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {})
|
|
|
|
return { buttonStyles, buttonGroupStyles }
|
|
})
|
|
|
|
// Computed properties for reactive states
|
|
const linkHidden = computed(
|
|
() => settingStore.get('Comfy.LinkRenderMode') === LiteGraph.HIDDEN_LINK
|
|
)
|
|
|
|
// Computed properties for command text
|
|
const fitViewCommandText = computed(() =>
|
|
formatKeySequence(
|
|
commandStore.getCommand('Comfy.Canvas.FitView')
|
|
).toUpperCase()
|
|
)
|
|
const minimapCommandText = computed(() =>
|
|
formatKeySequence(
|
|
commandStore.getCommand('Comfy.Canvas.ToggleMinimap')
|
|
).toUpperCase()
|
|
)
|
|
|
|
// Computed properties for button classes and states
|
|
const zoomButtonClass = computed(() => [
|
|
'bg-interface-panel-surface',
|
|
isModalVisible.value ? 'not-active:bg-button-active-surface!' : '',
|
|
'hover:bg-button-hover-surface!',
|
|
'p-0',
|
|
'h-8',
|
|
'w-15'
|
|
])
|
|
|
|
const minimapButtonClass = computed(() => ({
|
|
'bg-interface-panel-surface': true,
|
|
'hover:bg-button-hover-surface!': true,
|
|
'not-active:bg-button-active-surface!': settingStore.get(
|
|
'Comfy.Minimap.Visible'
|
|
),
|
|
'p-0': true,
|
|
'w-8': true,
|
|
'h-8': true
|
|
}))
|
|
|
|
// Computed properties for tooltip and aria-label texts
|
|
const fitViewTooltip = computed(() => {
|
|
const label = t('graphCanvasMenu.fitView')
|
|
const shortcut = fitViewCommandText.value
|
|
return shortcut ? `${label} (${shortcut})` : label
|
|
})
|
|
const minimapTooltip = computed(() => {
|
|
const label = settingStore.get('Comfy.Minimap.Visible')
|
|
? t('zoomControls.hideMinimap')
|
|
: t('zoomControls.showMinimap')
|
|
const shortcut = minimapCommandText.value
|
|
return shortcut ? `${label} (${shortcut})` : label
|
|
})
|
|
const linkVisibilityTooltip = computed(() =>
|
|
linkHidden.value
|
|
? t('graphCanvasMenu.showLinks')
|
|
: t('graphCanvasMenu.hideLinks')
|
|
)
|
|
const linkVisibilityAriaLabel = computed(() =>
|
|
linkHidden.value
|
|
? t('graphCanvasMenu.showLinks')
|
|
: t('graphCanvasMenu.hideLinks')
|
|
)
|
|
const linkVisibleClass = computed(() => [
|
|
'bg-interface-panel-surface',
|
|
linkHidden.value ? 'not-active:bg-button-active-surface!' : '',
|
|
'hover:bg-button-hover-surface!',
|
|
'p-0',
|
|
'w-8',
|
|
'h-8'
|
|
])
|
|
|
|
onMounted(() => {
|
|
canvasStore.initScaleSync()
|
|
})
|
|
|
|
/**
|
|
* Track minimap toggle button click and execute the command.
|
|
*/
|
|
const onMinimapToggleClick = () => {
|
|
useTelemetry()?.trackUiButtonClicked({
|
|
button_id: 'graph_menu_minimap_toggle_clicked'
|
|
})
|
|
void commandStore.execute('Comfy.Canvas.ToggleMinimap')
|
|
}
|
|
|
|
/**
|
|
* Track hide/show links button click and execute the command.
|
|
*/
|
|
const onLinkVisibilityToggleClick = () => {
|
|
useTelemetry()?.trackUiButtonClicked({
|
|
button_id: 'graph_menu_hide_links_toggle_clicked'
|
|
})
|
|
void commandStore.execute('Comfy.Canvas.ToggleLinkVisibility')
|
|
}
|
|
|
|
onBeforeUnmount(() => {
|
|
canvasStore.cleanupScaleSync()
|
|
})
|
|
</script>
|