-
Notifications
You must be signed in to change notification settings - Fork 374
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
base: main
Are you sure you want to change the base?
Conversation
🎭 Playwright Test Results🕵🏻 No test results found ⏰ Completed at: 09/27/2025, 05:08:47 PM UTC 📊 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
// TODO: implement loading node colors from workflow in Vue system | ||
test.fail('should load node colors from workflow', async ({ comfyPage }) => { | ||
await comfyPage.loadWorkflow('nodes/every_node_color') | ||
await expect(comfyPage.canvas).toHaveScreenshot( | ||
'vue-node-custom-colors-dark-all-colors.png' | ||
) | ||
}) | ||
|
||
// TODO: implement loading node colors from workflow in Vue system | ||
test.fail( |
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.
Expect these to fail until loading custom colors from workflow is implemented.
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?
src/lib/litegraph/src/LGraphNode.ts
Outdated
if (oldColor !== newColor) { | ||
this.graph.trigger('node:property:changed', { | ||
nodeId: this.id, | ||
property: 'color', | ||
oldValue: oldColor, | ||
newValue: newColor | ||
}) | ||
} | ||
if (oldBgcolor !== newBgcolor) { | ||
this.graph.trigger('node:property:changed', { | ||
nodeId: this.id, | ||
property: 'bgcolor', | ||
oldValue: oldBgcolor, | ||
newValue: newBgcolor | ||
}) | ||
} |
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.
I think if you add color
and bgcolor
here you can remove this section.
…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 <Myestery@users.noreply.github.com>
…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 <DrJKL@users.noreply.github.com>
d3c15b0
to
b4413e7
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.color
andnodeData.bgcolor
to 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
┆Issue is synchronized with this Notion page by Unito