From 3bf774ba0cee789af4037fa96b807c8180c465c4 Mon Sep 17 00:00:00 2001 From: space-nuko <24979496+space-nuko@users.noreply.github.com> Date: Fri, 12 May 2023 11:22:35 -0500 Subject: [PATCH] Gradio dark theme --- src/lib/api.ts | 6 +- src/lib/components/AccordionContainer.svelte | 4 +- src/lib/components/ComfyApp.svelte | 34 +- src/lib/components/ComfyApp.ts | 7 +- src/lib/components/ComfyProperties.svelte | 9 +- src/lib/components/ComfyQueue.svelte | 192 +++-- src/lib/stores/queueState.ts | 93 ++- src/lib/utils.ts | 2 +- src/lib/widgets/ComboWidget.svelte | 38 +- src/scss/global.scss | 70 ++ src/scss/gradio.scss | 772 ++++++++++--------- 11 files changed, 735 insertions(+), 492 deletions(-) diff --git a/src/lib/api.ts b/src/lib/api.ts index d668fe8..b7d502d 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -154,7 +154,7 @@ export default class ComfyAPI { this.clientId = msg.data.sid; sessionStorage["Comfy.SessionId"] = this.clientId; } - this.eventBus.emit("status", msg.data.status); + this.eventBus.emit("status", { execInfo: { queueRemaining: msg.data.status.exec_info.queue_remaining } }); break; case "progress": this.eventBus.emit("progress", msg.data as Progress); @@ -172,10 +172,10 @@ export default class ComfyAPI { this.eventBus.emit("execution_error", msg.data.prompt_id, msg.data.message); break; default: - throw new Error(`Unknown message type: ${msg.type} ${msg}`); + console.warn("Unhandled message:", event.data); } } catch (error) { - console.warn("Unhandled message:", event.data); + console.error("Error handling message", event.data, error); } }); } diff --git a/src/lib/components/AccordionContainer.svelte b/src/lib/components/AccordionContainer.svelte index 6b99cc2..978da9e 100644 --- a/src/lib/components/AccordionContainer.svelte +++ b/src/lib/components/AccordionContainer.svelte @@ -179,8 +179,8 @@ } } - :global(.label-wrap > span:not(.icon)) { - /* color: var(--block-title-text-color); */ + :global(.label-wrap > span) { + color: var(--block-title-text-color); font-size: 16px; } diff --git a/src/lib/components/ComfyApp.svelte b/src/lib/components/ComfyApp.svelte index 589efe1..8eddb03 100644 --- a/src/lib/components/ComfyApp.svelte +++ b/src/lib/components/ComfyApp.svelte @@ -31,7 +31,7 @@ let containerElem: HTMLDivElement; let resizeTimeout: NodeJS.Timeout | null; let hasShownUIHelpToast: boolean = false; - let uiTheme: string = ""; + let uiTheme: string = "gradio-dark"; let fileInput: HTMLInputElement = undefined; let debugLayout: boolean = false; @@ -182,6 +182,13 @@ async function doRefreshCombos() { await app.refreshComboInNodes(true) } + + $: if (uiTheme === "gradio-dark") { + document.getElementById("app").classList.add("dark") + } + else { + document.getElementById("app").classList.remove("dark") + } @@ -190,7 +197,7 @@ {/if} -
+
@@ -264,7 +271,8 @@ Theme @@ -280,8 +288,10 @@