What is the best way to find out which color wire goes to which color screw? Does the white wire go to the silver screw sometimes, and sometimes to black? I have a three way switch which has a green screw and a black screw and three brass I don't know which one is which.
Basic 3-way switches
When working with basic 3-way snap switches, the switch should have four terminal.
Common, COM, or C
This terminal will typically be black, or some color other than green or silver. It may be brass, in which case it will be labeled or marked in some way as common.
The common terminal will either be connected to the ungrounded (hot) LINE wire coming from the power source, or to the ungrounded (hot) LOAD wire going to the load (lights).
This terminal will typically be green, and will likely be either at the top of the bottom of the switch.
These terminals will commonly be brass. These terminals are used to carry power between the switches, and will alternate being live. Depending on how the switch is toggled, one of these terminals will always have voltage (assuming the circuit is working properly).
These types of switches will usually offer some extra functionality, other than simply turning the lights on/off. Because of this, the switch may also require a neutral wire.
The neutral terminal on a smart switch will often be silver, and is used to connect a circuit neutral wire to the switch.
Wire color is meant to help determine the function of a wire, however, it can often be wrong. White wires can, from time to time, be used as ungrounded (hot) wires (though they're supposed to be marked when they are). Your best bet, is to never trust the person that installed the wiring, and always test the wires yourself.
A 3-way circuit should look something like this.
However, wiring in a building is not typically this straightforward. So you might find cases where power goes to the light first, or other strangeness.
The best way is to do some reading on the type of circuit you're working with and make sure you understand the core concepts. Most circuits can be configured in several different ways, so there's no way to simply arrive at an answer.
In the case of a typical 3-way switch, the black screw is usually used for the hot lead. The bare brass screws are for "travellers", which transmit power from the hot lead to the other switch or light box in accordance with the switch position.
As Carl Witthoft mentioned, green is always ground and should only be connected to bare copper leads.
Colors mean nothing
In the United States, land of freedom, there are no strict color codes except green, green-yellow or bare can only be ground. Hots can be any other color. Neutrals can only be gray or white, but so can hots.
And since multi-wire cables come in very limited colors (black/white/bare or black/white/red/bare), even the above is not a sure thing.
In 3-way switch circuits (UK/EU people call this a 2-way), the white wire in a multiconductor cable often gets used as a hot or switched-hot. This is also true in older switch loops.
That said, when possible, people often like to use white for neutral, black for always-hot, and red for switched-hot, to the extent that's possible.
Anytime you see a white or gray wire which is not actually being used for neutral, try to put a few wraps of electrical tape around the wire, so as to mark it as not neutral. This type of marking is not allowed for neutrals or grounds (unless the wire size is quite large, 4 AWG or bigger, as electrical distributors have said they will not stock 3 different colors of large wire).
3-ways are all about topology. Thinking about colors is useless.
So... colors are useless in wires. What about 3-way switches?
First, there's the ground screw. Attach it then disregard it.
The 3 remaining screws -- 2 have the same color, one is a different color. The oddball is the common wire, i.e. the one at the apex of the switch you see in all the diagrams. The other 2 screws are the same color, those are the travelers. Those are a matched pair and they are interchangeable, so you don't need to spend any brain cells telling travelers apart.
Aside from the 2 travelers, there must also be a return of some kind, which bypasses the switch. What that does exactly, depends on how the 3-way switch is laid out. If the topology is power-source/switch/switch/lamp, the return wire will be neutral. If the switches are a spur, then the return wire will be either a hot or switched-hot. As such, you could choose the preferred color for the "return wire", and use the other two for travelers.
If you get the impression we all kinda "make it up" in 3-way switch circuits -- you got it!