two ways to go about this:
take the number of microswitches (24 in your case) multiply by 2 to get the total number of connections. Take this and multiply it by the longest run from your encoder or keyboard hack and add about 25% for a buffer. that should cover you. Remember the common is daisy chain so you won't use as much wire for that.
the other way is to buy an "a$$load". that should be about right.

trust me you'll use it sometime.
now as far as the different colors, just take your total footage and divide it amongst the different schemes you want. the simple way is one color for common and one for everything else. I do reccomend at least that. It makes sorting out things a little easier.
hope that helped
ny