feat: color output dots by type/value on execution

ProjectKey: dot color matches ComfyUI's type color map (INT/FLOAT),
or green/grey for BOOLEAN based on actual value.
BinaryIndexDecoder: same green/grey per-output based on true/false.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-04 13:29:10 +02:00
parent 4b19ad0a1d
commit bc61033826
2 changed files with 18 additions and 3 deletions
+14 -2
View File
@@ -203,12 +203,24 @@ app.registerExtension({
// --- Show live value on output slot after execution (INT/FLOAT/BOOL only) ---
nodeType.prototype.onExecuted = function (output) {
if (!output?.value?.[0] === undefined || !this.outputs.length) return;
const val = output.value?.[0];
if (!this.outputs.length) return;
const val = output?.value?.[0];
if (val === undefined) return;
const keyWidget = this.widgets?.find(w => w.name === "key_name");
const name = keyWidget?.value || this.outputs[0].name;
this.outputs[0].label = `${val} ${name}`;
const slotType = this.outputs[0].type;
let color;
if (slotType === "BOOLEAN") {
color = (val === "true") ? "#4caf50" : "#888888";
} else {
color = LGraphCanvas?.link_type_colors?.[slotType]
|| app.canvas?.default_connection_color_byType?.[slotType];
}
if (color) {
this.outputs[0].color_on = color;
this.outputs[0].color_off = color;
}
app.graph?.setDirtyCanvas(true, true);
};