Skip to content

fix: dark theme broken on new ComfyUI frontend - #82

Open
Samurai019 wants to merge 2 commits into
newtextdoc1111:mainfrom
Samurai019:fix-dark-theme-selector
Open

Samurai019 wants to merge 2 commits into
newtextdoc1111:mainfrom
Samurai019:fix-dark-theme-selector

Conversation

@Samurai019

Copy link
Copy Markdown

Problem

The new Vue-based ComfyUI frontend applies the .dark-theme class to document.documentElement (<html>) instead of <body>:

// ComfyUI_frontend GraphView
let t = `dark-theme`;
e.light_theme
  ? document.documentElement.classList.remove(t)
  : document.documentElement.classList.add(t)

As a result, the body.dark-theme { ... } selector in autocomplete-plus.css no longer matches, and the autocomplete / related-tags popups fall back to the light-theme variables — light gray rows (--p-neutral-300/400) on a dark UI, making text hard to read.

Fix

Match :root.dark-theme body in addition to body.dark-theme, so the dark theme variables apply on both the old frontend (class on <body>) and the new frontend (class on <html>).

-/* Dark Theme */
-body.dark-theme {
+/* Dark Theme */
+/* Old frontend puts .dark-theme on <body>; new Vue frontend puts it on <html> (documentElement) */
+body.dark-theme,
+:root.dark-theme body {

Tested locally on the latest ComfyUI frontend: popup rows render with the correct dark colors again.

The new Vue-based ComfyUI frontend applies the .dark-theme class to
document.documentElement (<html>) instead of <body>, so the
'body.dark-theme' selector no longer matches and the popup falls back
to light-theme variables (light gray rows on a dark UI).

Match ':root.dark-theme body' as well to stay compatible with both
old and new frontends.
@cozdx1

cozdx1 commented Sep 13, 2026

Copy link
Copy Markdown

Verified this fix locally against ComfyUI 0.34.0 with comfyui-frontend-package 1.51.9 on Windows.

Before applying the selector change:

  • <html> had the dark-theme class while <body> did not.
  • The computed autocomplete row tokens resolved to the light values #d4d4d4 and #a3a3a3.

After applying this PR:

  • The row tokens resolve to the intended dark values #262626 and #171717.
  • npm test -- --runInBand: 161 tests passed.
  • npx stylelint "web/css/**/*.css": passed.

This directly resolves the light autocomplete rows on the current Vue frontend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants