mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-10 10:00:08 +00:00
fix terminal style (#6056)
## Summary After #5292, at certain browser zoom levels, the xterm terminal did not fill horizontal space properly, showing a gap with mismatched background colors (`#171717` viewport vs `black` terminal content). Fixes https://github.com/Comfy-Org/ComfyUI_frontend/issues/6049 ## Problem The hardcoded `#171717` terminal theme background only affected the xterm viewport, while terminal content remained black, causing a visible color mismatch at low zoom levels where the gap was more apparent. Fixed by keeping original theme when not on desktop distribution. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6056-fix-terminal-style-28c6d73d36508132b521e5767f41d540) by [Unito](https://www.unito.io)
This commit is contained in:
committed by
Arjan Singh
parent
d5fa22168d
commit
05f73523f3
@@ -5,12 +5,14 @@ import { debounce } from 'es-toolkit/compat'
|
|||||||
import type { Ref } from 'vue'
|
import type { Ref } from 'vue'
|
||||||
import { markRaw, onMounted, onUnmounted } from 'vue'
|
import { markRaw, onMounted, onUnmounted } from 'vue'
|
||||||
|
|
||||||
|
import { isDesktop } from '@/platform/distribution/types'
|
||||||
|
|
||||||
export function useTerminal(element: Ref<HTMLElement | undefined>) {
|
export function useTerminal(element: Ref<HTMLElement | undefined>) {
|
||||||
const fitAddon = new FitAddon()
|
const fitAddon = new FitAddon()
|
||||||
const terminal = markRaw(
|
const terminal = markRaw(
|
||||||
new Terminal({
|
new Terminal({
|
||||||
convertEol: true,
|
convertEol: true,
|
||||||
theme: { background: '#171717' }
|
theme: isDesktop ? { background: '#171717' } : undefined
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
terminal.loadAddon(fitAddon)
|
terminal.loadAddon(fitAddon)
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { isElectron } from '@/utils/envUtil'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Distribution types and compile-time constants for managing
|
* Distribution types and compile-time constants for managing
|
||||||
* multi-distribution builds (Desktop, Localhost, Cloud)
|
* multi-distribution builds (Desktop, Localhost, Cloud)
|
||||||
@@ -13,6 +15,6 @@ declare global {
|
|||||||
const DISTRIBUTION: Distribution = __DISTRIBUTION__
|
const DISTRIBUTION: Distribution = __DISTRIBUTION__
|
||||||
|
|
||||||
/** Distribution type checks */
|
/** Distribution type checks */
|
||||||
// const isDesktop = DISTRIBUTION === 'desktop'
|
export const isDesktop = DISTRIBUTION === 'desktop' || isElectron() // TODO: replace with build var
|
||||||
// const isLocalhost = DISTRIBUTION === 'localhost'
|
|
||||||
export const isCloud = DISTRIBUTION === 'cloud'
|
export const isCloud = DISTRIBUTION === 'cloud'
|
||||||
|
// export const isLocalhost = !isDesktop && !isCloud
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ globalThis.__ALGOLIA_APP_ID__ = ''
|
|||||||
globalThis.__ALGOLIA_API_KEY__ = ''
|
globalThis.__ALGOLIA_API_KEY__ = ''
|
||||||
// @ts-expect-error - Global variables are defined in global.d.ts
|
// @ts-expect-error - Global variables are defined in global.d.ts
|
||||||
globalThis.__USE_PROD_CONFIG__ = false
|
globalThis.__USE_PROD_CONFIG__ = false
|
||||||
|
globalThis.__DISTRIBUTION__ = 'localhost'
|
||||||
|
|
||||||
// Mock Worker for extendable-media-recorder
|
// Mock Worker for extendable-media-recorder
|
||||||
globalThis.Worker = vi.fn().mockImplementation(() => ({
|
globalThis.Worker = vi.fn().mockImplementation(() => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user