From 204e0ef5b9b2882305bde06e3203752d70317c80 Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Mon, 28 Oct 2024 13:46:46 +1100 Subject: [PATCH] Add default group colour option LiteGraph.DEFAULT_GROUP_COLOR must be configured to make use of this change. --- src/LGraphGroup.ts | 4 ++-- src/LiteGraphGlobal.ts | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/LGraphGroup.ts b/src/LGraphGroup.ts index 23847e7d..38967f95 100644 --- a/src/LGraphGroup.ts +++ b/src/LGraphGroup.ts @@ -121,8 +121,8 @@ export class LGraphGroup { draw(graphCanvas: LGraphCanvas, ctx: CanvasRenderingContext2D): void { const padding = 4 - ctx.fillStyle = this.color - ctx.strokeStyle = this.color + ctx.fillStyle = this.color ?? LiteGraph.DEFAULT_GROUP_COLOR + ctx.strokeStyle = this.color ?? LiteGraph.DEFAULT_GROUP_COLOR const [x, y] = this._pos const [width, height] = this._size ctx.globalAlpha = 0.25 * graphCanvas.editor_alpha diff --git a/src/LiteGraphGlobal.ts b/src/LiteGraphGlobal.ts index b9bedbd3..7ef78014 100644 --- a/src/LiteGraphGlobal.ts +++ b/src/LiteGraphGlobal.ts @@ -48,6 +48,7 @@ export class LiteGraphGlobal { DEFAULT_SHADOW_COLOR = "rgba(0,0,0,0.5)" DEFAULT_GROUP_FONT = 24 DEFAULT_GROUP_FONT_SIZE?: any + DEFAULT_GROUP_COLOR?: string WIDGET_BGCOLOR = "#222" WIDGET_OUTLINE_COLOR = "#666"