mirror of
https://github.com/jags111/efficiency-nodes-comfyui.git
synced 2026-03-24 06:32:13 -03:00
Improve Compatability with Nested Nodes
This commit is contained in:
@@ -63,6 +63,7 @@ let colorKeys = Object.keys(COLOR_THEMES).filter(key => key !== "none");
|
|||||||
shuffleArray(colorKeys); // Shuffle the color themes initially
|
shuffleArray(colorKeys); // Shuffle the color themes initially
|
||||||
|
|
||||||
function setNodeColors(node, theme) {
|
function setNodeColors(node, theme) {
|
||||||
|
if (!theme) {return;}
|
||||||
node.shape = "box";
|
node.shape = "box";
|
||||||
if(theme.nodeColor && theme.nodeBgColor) {
|
if(theme.nodeColor && theme.nodeBgColor) {
|
||||||
node.color = theme.nodeColor;
|
node.color = theme.nodeColor;
|
||||||
@@ -79,9 +80,10 @@ const ext = {
|
|||||||
let colorKey = NODE_COLORS[title];
|
let colorKey = NODE_COLORS[title];
|
||||||
|
|
||||||
if (colorKey === "random") {
|
if (colorKey === "random") {
|
||||||
if (colorKeys.length === 0) {
|
// Check for a valid color key before popping
|
||||||
colorKeys = Object.values(COLOR_THEMES).filter(theme => theme.nodeColor && theme.nodeBgColor);
|
if (colorKeys.length === 0 || !COLOR_THEMES[colorKeys[colorKeys.length - 1]]) {
|
||||||
shuffleArray(colorKeys); // Reshuffle when out of colors
|
colorKeys = Object.keys(COLOR_THEMES).filter(key => key !== "none");
|
||||||
|
shuffleArray(colorKeys);
|
||||||
}
|
}
|
||||||
colorKey = colorKeys.pop();
|
colorKey = colorKeys.pop();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user