Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
aegis72 opened this issue Dec 15, 2023 · 3 comments
Open

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

aegis72 opened this issue Dec 15, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@aegis72
Copy link

aegis72 commented Dec 15, 2023

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 aegis72 added the enhancement New feature or request label Dec 15, 2023
@aegis72
Copy link
Author

aegis72 commented Dec 15, 2023

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
Copy link
Member

@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
Copy link
Author

aegis72 commented Jan 26, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants