diff --git a/web/binary_index_decoder.js b/web/binary_index_decoder.js index 7e6ddfa..5304e65 100644 --- a/web/binary_index_decoder.js +++ b/web/binary_index_decoder.js @@ -9,7 +9,10 @@ app.registerExtension({ nodeType.prototype.onExecuted = function (output) { if (!output?.values) return; for (let i = 0; i < Math.min(output.values.length, this.outputs.length); i++) { - this.outputs[i].label = `${output.values[i]} ${this.outputs[i].name}`; + const val = output.values[i]; + this.outputs[i].label = `${val} ${this.outputs[i].name}`; + this.outputs[i].color_on = (val === "true") ? "#4caf50" : "#888888"; + this.outputs[i].color_off = (val === "true") ? "#4caf50" : "#888888"; } app.graph?.setDirtyCanvas(true, true); }; diff --git a/web/project_key.js b/web/project_key.js index 5e54ec2..11a370e 100644 --- a/web/project_key.js +++ b/web/project_key.js @@ -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); };