-
Notifications
You must be signed in to change notification settings - Fork 395
Allow Vue nodes to have their colors changed from selection toolbox #5720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🎭 Playwright Test Results⏰ Completed at: 09/27/2025, 10:04:55 PM UTC 📈 Summary
📊 Test Reports by Browser
🎉 Click on the links above to view detailed test results for each browser configuration. |
| headerColor = adjustColor(nodeData.color, { lightness: -0.15 }) | ||
| } | ||
| // Apply light theme lightening on top of base darkening (same as drawNode monkey patch) | ||
| if (colorPaletteStore.completedActivePalette.light_theme) { | ||
| headerColor = adjustColor(headerColor, { lightness: 0.5 }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a better way to do this with CSS? adjustColor is memoized though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
color-mix() with white ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's safe to assume that would be more performant right? Not sure performance different is measurable though, so maybe other pros/cons should be considered. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we were able to bind to a CSS variable and derive from it a lighter and a darker shade, we could eliminate all of this logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to support any arbitrary color set by extensions though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would work, the css variable can be dynamic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TY, let me try tomorrow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic is a bit convulated when trying to do in CSS especially since we need to serialize color in the workflow, decided against it for this PR.
| transform: `translate(${layoutPosition.x ?? position?.x ?? 0}px, ${(layoutPosition.y ?? position?.y ?? 0) - LiteGraph.NODE_TITLE_HEIGHT}px)`, | ||
| zIndex: zIndex | ||
| zIndex: zIndex, | ||
| // Explicitly set backgroundColor to ensure reset works properly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // Explicitly set backgroundColor to ensure reset works properly | |
| color: nodeData.color || '' |
Where are we setting color?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The naming in Litegraph is poor.
They're both surface colors, one for the header, one for the body, neither for the text.
| .click() | ||
|
|
||
| await expect(comfyPage.canvas).toHaveScreenshot( | ||
| 'vue-node-custom-color-blue.png' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from the screenshot, can we have another test that reads the color or backgroundColor prop from the node?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What additional signal would that provide?
d3c15b0 to
b4413e7
Compare
…view feedback Adds CSS background-color property validation in addition to screenshot comparison to verify header and body colors are correctly applied to DOM elements. Co-authored-by: Myestery <[email protected]>
…resses review feedback Moves color and bgcolor property change tracking to the standard LGraphNodeProperties system instead of manual event firing in setColorOption. This reduces custom code and leverages the existing property instrumentation infrastructure. Co-authored-by: DrJKL <[email protected]>
The :style binding was accidentally removed, causing TypeScript error about unused headerStyle computed property. This binding is needed for Vue node header color functionality.
Now correctly implements all aspects of the LiteGraph drawNode monkey patch: 1. Header colors: Apply opacity + lightness adjustments like LiteGraph 2. Body colors: Apply same adjustments to background as LiteGraph 3. Opacity setting: Support 'Comfy.Node.Opacity' setting from user preferences 4. Light theme: Apply lightness=0.5 to both header and body in light theme This ensures Vue nodes have pixel-perfect color matching with LiteGraph nodes across all themes and opacity settings.
30e010a to
481aa82
Compare
Summary
Fixes #5680 by allowing Vue nodes to properly synchronize color changes with LiteGraph nodes, implementing header darkening and light theme adjustments.
Changes
nodeData.colorandnodeData.bgcolorto v-memo dependencies to trigger re-renders on color changesReview Focus
Vue component reactivity timing - the v-memo fix was critical for immediate color updates. Verify light theme color adjustments match the drawNode monkey patch behavior in app.ts.
Technical Details
graph TD A[User Sets Color] --> B[LGraphNode.setColorOption] B --> C[Sets node.color & node.bgcolor] C --> D[Triggers property:changed events] D --> E[Vue Node Manager Updates] E --> F[v-memo Detects Change] F --> G[NodeHeader Re-renders] G --> H[Header Darkening Applied] style A fill:#f9f9f9,stroke:#333,color:#000 style H fill:#f9f9f9,stroke:#333,color:#000┆Issue is synchronized with this Notion page by Unito