mirror of
https://github.com/jags111/efficiency-nodes-comfyui.git
synced 2026-03-23 22:22:12 -03:00
V1.92 Efficiency Nodes MEGA Update (SDXL + MORE)
This PR is a huge update, I added/fixed so many things that I will explain all the updates later on the release notes.
This commit is contained in:
95
js/appearance.js
Normal file
95
js/appearance.js
Normal file
@@ -0,0 +1,95 @@
|
||||
import { app } from "../../scripts/app.js";
|
||||
|
||||
const COLOR_THEMES = {
|
||||
red: { nodeColor: "#332222", nodeBgColor: "#553333" },
|
||||
green: { nodeColor: "#223322", nodeBgColor: "#335533" },
|
||||
blue: { nodeColor: "#222233", nodeBgColor: "#333355" },
|
||||
pale_blue: { nodeColor: "#2a363b", nodeBgColor: "#3f5159" },
|
||||
cyan: { nodeColor: "#223333", nodeBgColor: "#335555" },
|
||||
purple: { nodeColor: "#332233", nodeBgColor: "#553355" },
|
||||
yellow: { nodeColor: "#443322", nodeBgColor: "#665533" },
|
||||
none: { nodeColor: null, nodeBgColor: null } // no color
|
||||
};
|
||||
|
||||
const NODE_COLORS = {
|
||||
"KSampler (Efficient)": "random",
|
||||
"KSampler Adv. (Efficient)": "random",
|
||||
"KSampler SDXL (Eff.)": "random",
|
||||
"Efficient Loader": "random",
|
||||
"Eff. Loader SDXL": "random",
|
||||
"LoRA Stacker": "blue",
|
||||
"Control Net Stacker": "green",
|
||||
"Apply ControlNet Stack": "none",
|
||||
"XY Plot": "purple",
|
||||
"Unpack SDXL Tuple": "none",
|
||||
"Pack SDXL Tuple": "none",
|
||||
"XY Input: Seeds++ Batch": "cyan",
|
||||
"XY Input: Add/Return Noise": "cyan",
|
||||
"XY Input: Steps": "cyan",
|
||||
"XY Input: CFG Scale": "cyan",
|
||||
"XY Input: Sampler/Scheduler": "cyan",
|
||||
"XY Input: Denoise": "cyan",
|
||||
"XY Input: VAE": "cyan",
|
||||
"XY Input: Prompt S/R": "cyan",
|
||||
"XY Input: Aesthetic Score": "cyan",
|
||||
"XY Input: Refiner On/Off": "cyan",
|
||||
"XY Input: Checkpoint": "cyan",
|
||||
"XY Input: Clip Skip": "cyan",
|
||||
"XY Input: LoRA": "cyan",
|
||||
"XY Input: LoRA Plot": "cyan",
|
||||
"XY Input: LoRA Stacks": "cyan",
|
||||
"XY Input: Control Net": "cyan",
|
||||
"XY Input: Control Net Plot": "cyan",
|
||||
"XY Input: Manual XY Entry": "cyan",
|
||||
"Manual XY Entry Info": "cyan",
|
||||
"Join XY Inputs of Same Type": "cyan",
|
||||
"Image Overlay": "random",
|
||||
"HighRes-Fix Script": "yellow",
|
||||
"Tiled Sampling Script": "none",
|
||||
"Evaluate Integers": "pale_blue",
|
||||
"Evaluate Floats": "pale_blue",
|
||||
"Evaluate Strings": "pale_blue",
|
||||
"Simple Eval Examples": "pale_blue",
|
||||
};
|
||||
|
||||
function shuffleArray(array) {
|
||||
for (let i = array.length - 1; i > 0; i--) {
|
||||
const j = Math.floor(Math.random() * (i + 1));
|
||||
[array[i], array[j]] = [array[j], array[i]]; // Swap elements
|
||||
}
|
||||
}
|
||||
|
||||
let colorKeys = Object.keys(COLOR_THEMES).filter(key => key !== "none");
|
||||
shuffleArray(colorKeys); // Shuffle the color themes initially
|
||||
|
||||
function setNodeColors(node, theme) {
|
||||
node.shape = "box";
|
||||
if(theme.nodeColor && theme.nodeBgColor) {
|
||||
node.color = theme.nodeColor;
|
||||
node.bgcolor = theme.nodeBgColor;
|
||||
}
|
||||
}
|
||||
|
||||
const ext = {
|
||||
name: "efficiency.appearance",
|
||||
|
||||
nodeCreated(node) {
|
||||
const title = node.getTitle();
|
||||
if (NODE_COLORS.hasOwnProperty(title)) {
|
||||
let colorKey = NODE_COLORS[title];
|
||||
|
||||
if (colorKey === "random") {
|
||||
if (colorKeys.length === 0) {
|
||||
colorKeys = Object.values(COLOR_THEMES).filter(theme => theme.nodeColor && theme.nodeBgColor);
|
||||
shuffleArray(colorKeys); // Reshuffle when out of colors
|
||||
}
|
||||
colorKey = colorKeys.pop();
|
||||
}
|
||||
|
||||
const theme = COLOR_THEMES[colorKey];
|
||||
setNodeColors(node, theme);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
app.registerExtension(ext);
|
||||
Reference in New Issue
Block a user