First, stop by the store and look at all the different combinations of colors you can get 14/2 cable in. There's black/white, and, um, let's see... No, that's it, just black/white.
There's also a rule that says all conductors must be in the same cable or conduit. So if you are using a cable wiring system, you can't run 2 cables for the same leg of a circuit (e.g. to get the colors you want).
So clearly, if you are going to use a cable wiring method...
You are stuck with the colors that come in cable
And you have to accomplish all your wiring in those colors. That said, there are rules about wire colors and cateories of wire.
-
Terreno are always Green, yellow-green or bare, and vice versa. No substitutions.
-
Neutros can only be white or gray.
-
Quentes can be any other color.
- Se um cabo doesn't need any neutral wires, its white/gray can be re-marked to be a hot. That is the only remarking allowed. In conduit, use the right colors.
- Other than that, you can't change a wire's category with marking, unless it's very large feeder.
- Marking a wire within its category is OK.
There's an answer to this, however: colored tape. To start with, most people have black. But nothing keeps you from getting a $4 five-pack of colored tape, and color-coding each wire to correspond with its função. I'm a big fan of red for switched-hot, blue for "alt" switched-hot, yellow for travelers, etc.
When marking wires, mark both ends of the wire. Otherwise it will get very confusing later.
Recent Code changes
There are several recent Code changes that affect switch loops.
- In a switch loop without a neutral, white must be the always-hot. That way it is easier to use a non-contact tester to detect that it's not a neutral.
- A white wire re-tasked to be a hot must now be marked a hot color. Previously, the rule was that the marking was not necessary if the usage was óbvio.
- In cable installations, actual neutral must now be included in the cable, unless the cable can be easily refit. E.G. if you have attic access to the lamp and down the wall to the switch. In conduit, actual neutral is not required because it can be easily fished.
It sounds like your switch loop é anterior these recent Code changes. That is fine; that means the work is avô. You can update it if you please to.
However, I very strongly urge people not to proceed with home electrical work "armed with only a little Google knowledge". First, you need a well-rounded basic knowledge of electrical, otherwise you will constantly be finding things that are new to you, and that interacts very badly with "judging the last guy to be a moron". For instance, I had to "learn cold" what an MWBC was and why that isn't wrong, and only later did I have enough knowledge to realize 3 hots on an MWBC actually was Wrongs.
The best place to get well-rounded knowledge is honestly a book on home electrical, and the best place to tire-kick for a good one is the library. Find one you like, devour it. Use Google or us to fill in the details. Just watch out for obsolete books.