diff --git a/sticky-note/stickyNote.js b/sticky-note/stickyNote.js new file mode 100644 index 0000000..c16278d --- /dev/null +++ b/sticky-note/stickyNote.js @@ -0,0 +1,39 @@ +import { app } from "/scripts/app.js"; +import { ComfyWidgets } from "/scripts/widgets.js"; + +// For adding notes +const id = "pysssss.StickyNote"; +app.registerExtension({ + name: id, + addCustomNodeDefs(defs) { + defs.StickyNote = { + name: "StickyNote", + display_name: "Note", + category: "utils", + input: { + required: { + note: ["STRING", { multiline: true }], + }, + }, + }; + }, + beforeRegisterNodeDef(nodeType) { + if (nodeType.comfyClass === "StickyNote") { + const onNodeCreated = nodeType.prototype.onNodeCreated; + nodeType.prototype.onNodeCreated = function () { + const r = onNodeCreated?.apply(this, arguments); + + const w = this.widgets[0]; + w.inputEl.style.fontFamily = "cursive"; + w.inputEl.style.backgroundColor = "transparent"; + w.inputEl.style.mixBlendMode = "difference"; + w.inputEl.style.color = "white"; + + return r; + }; + + nodeType.color = "#ffff7c"; + nodeType.bgcolor = "#ffff7c"; + } + }, +});