Skip to content
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

allow custom bypass color #993

Merged
merged 3 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/extensions/core/colorPalette.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const colorPalettes: ColorPalettes = {
NODE_DEFAULT_BOXCOLOR: '#666',
NODE_DEFAULT_SHAPE: 'box',
NODE_BOX_OUTLINE_COLOR: '#FFF',
NODE_BYPASS_BGCOLOR: '#FF00FF',
DEFAULT_SHADOW_COLOR: 'rgba(0,0,0,0.5)',
DEFAULT_GROUP_FONT: 24,

Expand Down Expand Up @@ -107,6 +108,7 @@ const colorPalettes: ColorPalettes = {
NODE_DEFAULT_BOXCOLOR: '#CCC',
NODE_DEFAULT_SHAPE: 'box',
NODE_BOX_OUTLINE_COLOR: '#000',
NODE_BYPASS_BGCOLOR: '#FF00FF',
DEFAULT_SHADOW_COLOR: 'rgba(0,0,0,0.1)',
DEFAULT_GROUP_FONT: 24,

Expand Down Expand Up @@ -170,6 +172,7 @@ const colorPalettes: ColorPalettes = {
NODE_DEFAULT_BOXCOLOR: '#839496', // Base0
NODE_DEFAULT_SHAPE: 'box',
NODE_BOX_OUTLINE_COLOR: '#fdf6e3', // Base3
NODE_BYPASS_BGCOLOR: '#FF00FF',
DEFAULT_SHADOW_COLOR: 'rgba(0,0,0,0.5)',
DEFAULT_GROUP_FONT: 24,

Expand Down Expand Up @@ -246,6 +249,7 @@ const colorPalettes: ColorPalettes = {
NODE_DEFAULT_BOXCOLOR: '#6e7581',
NODE_DEFAULT_SHAPE: 'box',
NODE_BOX_OUTLINE_COLOR: '#FFF',
NODE_BYPASS_BGCOLOR: '#FF00FF',
DEFAULT_SHADOW_COLOR: 'rgba(0,0,0,0.5)',
DEFAULT_GROUP_FONT: 22,
WIDGET_BGCOLOR: '#2b2f38',
Expand Down Expand Up @@ -320,6 +324,7 @@ const colorPalettes: ColorPalettes = {
NODE_DEFAULT_BOXCOLOR: '#545d70',
NODE_DEFAULT_SHAPE: 'box',
NODE_BOX_OUTLINE_COLOR: '#e5eaf0',
NODE_BYPASS_BGCOLOR: '#FF00FF',
DEFAULT_SHADOW_COLOR: 'rgba(0,0,0,0.5)',
DEFAULT_GROUP_FONT: 24,
WIDGET_BGCOLOR: '#2e3440',
Expand Down Expand Up @@ -394,6 +399,7 @@ const colorPalettes: ColorPalettes = {
NODE_DEFAULT_BOXCOLOR: '#30363d',
NODE_DEFAULT_SHAPE: 'box',
NODE_BOX_OUTLINE_COLOR: '#e5eaf0',
NODE_BYPASS_BGCOLOR: '#FF00FF',
DEFAULT_SHADOW_COLOR: 'rgba(0,0,0,0.5)',
DEFAULT_GROUP_FONT: 24,
WIDGET_BGCOLOR: '#161b22',
Expand Down Expand Up @@ -696,6 +702,11 @@ app.registerExtension({
)
}
}
// Sets special case colors
if (colorPalette.colors.litegraph_base.NODE_BYPASS_BGCOLOR) {
app.bypassBgColor =
colorPalette.colors.litegraph_base.NODE_BYPASS_BGCOLOR
}
app.canvas.draw(true, true)
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/scripts/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export class ComfyApp {
bodyBottom: HTMLElement
canvasContainer: HTMLElement
menu: ComfyAppMenu
bypassBgColor: string

// @deprecated
// Use useExecutionStore().executingNodeId instead
Expand All @@ -154,6 +155,7 @@ export class ComfyApp {
parent: document.body
})
this.menu = new ComfyAppMenu(this)
this.bypassBgColor = '#FF00FF'

/**
* List of extensions that are registered with the app
Expand Down Expand Up @@ -1565,7 +1567,7 @@ export class ComfyApp {
// @ts-expect-error
if (node.mode === 4) {
// never
bgColor = '#FF00FF'
bgColor = app.bypassBgColor
this.editor_alpha = 0.2
} else {
bgColor = old_bgcolor || LiteGraph.NODE_DEFAULT_BGCOLOR
Expand Down
1 change: 1 addition & 0 deletions src/types/colorPalette.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const litegraphBaseSchema = z
NODE_DEFAULT_BOXCOLOR: z.string(),
NODE_DEFAULT_SHAPE: z.string(),
NODE_BOX_OUTLINE_COLOR: z.string(),
NODE_BYPASS_BGCOLOR: z.string(),
DEFAULT_SHADOW_COLOR: z.string(),
DEFAULT_GROUP_FONT: z.number(),
WIDGET_BGCOLOR: z.string(),
Expand Down
Loading