Boy, glad I asked... Would've screwed that up big time...
Part of the problem is that cables
(bundles of wires
inside a sheath) are color-coded for the convenience of the cable manufacturer, not to indicate purpose/function
. I strongly recommend (and for novices, *very* strongly recommend) you pause to understand wire function, and then, use colored electrical tape to re-mark the wires by their function.
- White for neutral (mandatory)
- Black for always-hot
- Red for switched-hot
- Blue for 2nd switched-hot in the same box
- Yellow for both 3-way travelers (no need to tell them apart, but 2 yellows is very distinctive and not likely to be mistaken for anything else).
- Blue for 2nd set of 3-way travelers if that ever comes up
Always mark both ends of the wire (at the same time so you don't forget).
So, since you want the lamp controllable by a switch and not on 24x7, the lamp's hot is a switched-hot, that gets red.
From there it's downhill: Plain switches get red and black (they connect always-hot to switched-hot, or they don't). They don't have any use for neutral (but smart switches do).
Once you have retagged all your wires by function, just join like color to like color. Easy peasy!
What would I use to secure the conductors in the box???
Wire nut. Do it properly - crank it down HARD and do a "pull test" holding the nut in one hand and yanking each wire in turn with the other. If any pull out, you bodged the job, refine your method and redo. Never, ever reach for tape as a "crutch" to hold a shoddy wire-nut job together: if they're falling apart they are also a bad connection,
and that will cause an arc-fault and a fire. If a wire-nut is fighting you a lot, make sure the size is appropriate for the job. Yellow is great for 2 wires, but for 3+ consider red nuts.
You can also use Wago style lever-nuts, Alumiconn lug connectors (if you use them on all copper wires, I won't tell
) or for 4-8 wires, the big daddy, MAC Blocks.
They also make stick-the-wire-in-the-hole (and it grabs) connectors, but they have the same problems as "backstab" connections on switches/receps.
In some cases you can use the recep or switch itself as a splice block - look for "screw-and-clamp" style receps/switches that take 2 wires under each screw. Those are the easiest to work with and provide good connection. But using the device as a splice can confuse novices.