Skip to content

Conversation

christian-byrne
Copy link
Contributor

@christian-byrne christian-byrne commented Sep 22, 2025

Summary

Fixes #5680 by allowing Vue nodes to properly synchronize color changes with LiteGraph nodes, implementing header darkening and light theme adjustments.

Screenshot from 2025-09-21 20-00-36

Changes

  • What: Implemented color property synchronization between LiteGraph and Vue node rendering systems
  • Core Fix: Added nodeData.color and nodeData.bgcolor to v-memo dependencies to trigger re-renders on color changes
  • Color Logic: Added header darkening using memoized color adjustments to match LiteGraph's ColorOption system
  • Event System: Enhanced property change instrumentation in LGraphNode.setColorOption to emit color/bgcolor events

Review 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
Loading

┆Issue is synchronized with this Notion page by Unito

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Sep 22, 2025
Copy link

github-actions bot commented Sep 22, 2025

🎭 Playwright Test Results

🕵🏻 No test results found

⏰ Completed at: 09/27/2025, 05:08:47 PM UTC

📊 Test Reports by Browser

  • chromium: Deployment failed
  • chromium-2x: Deployment failed
  • chromium-0.5x: Deployment failed
  • mobile-chrome: Deployment failed

🎉 Click on the links above to view detailed test results for each browser configuration.

Comment on lines +130 to +141
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 })
Copy link
Contributor Author

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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

color-mix() with white ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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?

Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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

Comment on lines +33 to +54
// 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(
Copy link
Contributor Author

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.

@christian-byrne christian-byrne requested review from DrJKL, benceruleanlu and Myestery and removed request for DrJKL September 22, 2025 04:42
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Explicitly set backgroundColor to ensure reset works properly
color: nodeData.color || ''

Where are we setting color?

Copy link
Contributor

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'
Copy link
Collaborator

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?

Copy link
Contributor

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?

DrJKL
DrJKL previously approved these changes Sep 22, 2025
Comment on lines 351 to 366
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
})
}
Copy link
Contributor

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.

christian-byrne and others added 3 commits September 27, 2025 10:06
…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>
@christian-byrne christian-byrne force-pushed the vue-node/fix/color-change-node branch from d3c15b0 to b4413e7 Compare September 27, 2025 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:customization area:vue-migration size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't change the nodes' color or bypass a node
3 participants