blib-la / blibla-comfyui-extensions

Extensions for ComfyUI
GNU Affero General Public License v3.0
138 stars 11 forks source link

Allow list of autocolor values to be built from a CSV or text list #17

Open aegis72 opened 7 months ago

aegis72 commented 7 months ago

Is your feature request related to a problem? Please describe. It isn't a problem, persay, but a function that could make the colors extension more powerful.

currently, the inclusion of auto-coloring for positive and negative works well and is very welcome.:

function colorPositiveNegative(app) {
  app.graph._nodes.forEach((node) => {
    // const onPropertyChanged = node.onPropertyChanged;
    // node.onPropertyChanged = function () {};
    if (node.title.toLowerCase().includes("positive")) {
      const bgcolor = hslToHex(120 / 360, 0.4, 0.3);
      node.bgcolor = bgcolor;
      node.color = shadeHexColor(node.bgcolor);
    } else if (node.title.toLowerCase().includes("negative")) {
      const bgcolor = hslToHex(0, 0.4, 0.3);
      node.bgcolor = bgcolor;
      node.color = shadeHexColor(node.bgcolor);
    }
    node.setDirtyCanvas(true, true);
  });
}

But is hard-coded and so adding new color rules isn't possible other than by extending the js file manually, which would make me out of sync with the original branch and require folks to get a special fork of colors.js.

One, it would be great to be able to style all nodes with a similar function exactly the same value. Two, i've recently started making HEAVY use of ChrisGoringe's "UE Nodes," which have an execution limiter based on node color.

By having the ability to title names with special regex keywords (.*sender.*/.*receiver.*/.*fromFX.*/.*fromIterate.* etc) I could improve the workflow's consistency and add a new way to limit what nodes are affected by UE node sends.

Describe the solution you'd like modify the code above in some fashion where it takes a regex value from column A of a supplied CSV or a text based dictionary based on line breaks (using [nodetitle],[rgb values format] ) and applies that color to all nodes with titles matching that regex. Example of how that would work in action (faked here; I've manually set the "toFx" and "fromFx" values to the same color ):

image

Bonus would be to have a way to edit that list from the interface, but externalizing it as a config file of sorts would work too.

Describe alternatives you've considered I was hoping to be able to feed a string value into a node to force a node to have a color that the workflow assigned, but I don't think that the UI works that way; IE the node color wouldn't get that node value until after once running.

aegis72 commented 7 months ago

Alternately, if this would be too difficult to add or not in line with your goals, would you be willing to help me break out this function alone so I could make my own "recolor" node that was simpler and just worked based on constants like "positive/negative/fx/ etc?" Then, while not being as elegant, I could package that with a node of my own and use it to achieve the same result w/o needing new code on your end? I could make an extension called "aegisflow_af-nodecolors" or something like that, and hardcode the colors for my specific needs.

pixelass commented 6 months ago

@aegis72 sorry for the late reply. Each function is standalone. you can just copy it and adjust as required.

  1. create your own folder in custom_nodes
  2. Add your copy and modify

But I will definitely look into this. It does make sense and I think it could be rather easy, Since this suite only does plain fronted it might be saved in the browser instance (I will see)

aegis72 commented 5 months ago

Thanks! We ended up making some extensions to the JS for node coloration and (check out aegisflow utility nodes) but this would still be generally useful. Now that I understand Comfy better I might try rigging this up a bit for my specific workflows, which are made to be standardized.