RedNode Router (advanced switch)
A colour-driven switch where the losing branches never even run
- input_1
- input_2
- input_3
- input_4
- input_5
- input_6
- input_7
- input_8
- selected
Every serious workflow ends up with "the switch problem": five branches, one should run, and you don't want to bypass the other four by hand every time. RedNode Router is the Studio's answer - a switch with up to eight *-typed inputs where each branch passes when its colours are on. It replaces whole chains of boolean gates, and the branches you didn't pick never execute. That last part is the whole point, and it's not a given: a lot of "switches" in ComfyUI just pick which value goes through, while every branch still burns compute upstream. The Router doesn't.
How it works
Two JSON strings do the thinking, and both are edited through the node's own panel rather than by hand. rules holds which colours each branch needs, in the form {slot: {colors: [...], mode: "all"|"any"}} - ALL means every listed colour must be on, ANY means one of them suffices. active holds the colours currently switched on, and it's mirrored from the RedNode Palette, the pack's colour state node. When you flip a colour on the palette, every Router in the workflow re-evaluates against it.
The mechanism underneath is simple but load-bearing: a branch with no matching colours passes when nothing else does (the fallback), and the whole thing is just first-match on the branch list. The execution trick - the reason losers don't run - is that a Router is lazy: it only asks for the input on the branch it actually selected, so ComfyUI never executes the unselected branches' upstream chains. This is the same always-lazy pattern the pack uses in its Stage Tap and Report nodes, and it's what separates a real router from a value picker.
The inputs that matter
input_1throughinput_8- the branches. Anything goes in any of them (*type), and each branch's required colours are set on the panel.rulesandactive- the JSON config, normally invisible; you only touch them if the panel UI is unavailable.
The single output, selected, is whatever the winning branch passed - same type as the input, since the node is type-agnostic.
Installing it
git clone https://github.com/RedNodeAI/ComfyUI-RedNodeStudio.git ComfyUI/custom_nodes/ComfyUI-RedNodeStudio
Restart ComfyUI, or search RedNode Studio in ComfyUI Manager. No pip deps, no model files. Python 3.10+.
The gotcha
Colours are the vocabulary here, and the palette is where they get switched - a Router with a rules panel you've never touched defaults to "first connected branch passes", which confuses people who expected colour-driven routing to just appear. And remember the any vs all mode: if a branch needs two colours and one is on, ANY passes it and ALL doesn't. When a branch fires that "shouldn't have", that mode is the first place to look. Also worth knowing: this Router works hand-in-glove with RedNode Router Control, which turns every Router's colour combinations into one switchboard - add that when the workflow grows past a handful of branches and you want a single place to route everything.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| rules | STRING | {} | which colours each branch needs, as JSON. The panel above edits this; editable by hand if the UI is unavailable. |
| active | STRING | [] | the colours switched on right now — mirrored from RedNode Palette. |
| input_1opt | * | branch 1 — connect anything; set its colours on the panel | |
| input_2opt | * | branch 2 — connect anything; set its colours on the panel | |
| input_3opt | * | branch 3 — connect anything; set its colours on the panel | |
| input_4opt | * | branch 4 — connect anything; set its colours on the panel | |
| input_5opt | * | branch 5 — connect anything; set its colours on the panel | |
| input_6opt | * | branch 6 — connect anything; set its colours on the panel | |
| input_7opt | * | branch 7 — connect anything; set its colours on the panel | |
| input_8opt | * | branch 8 — connect anything; set its colours on the panel |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| selected | * | — |