Alright so first things first, Using G Major as a template here are the
"in key" chords from the G-Major scale:
Now, If you feel the desire to use other chords w/ these w/o having the progression sound like crap then you need look no further than what are called "Secondary Dominant Chords". For each diatonic chord in any Maj/min key, (excluding the I/i chord and any diatonic diminished chords) there are these newfangled things called "secondary dominants" that allow you to temporarily (or permanently if u desire) cadence out of the current key and into another.
-Here is a list of some types of secondary dominants: V/of, V7/of, vii*/of, vii 1/2 dim7/of,and vii*7/of.
-the rule for figuring out the V/of or V7/of is to take the root you want to make a V(7)/of and go up a perfect fifth to find the Secondary dominants root and then using that note build a Major triad or a dominant seventh on top of it. So in the context of a G major, if u wanted to Cadence into a minor, you could build a V/ii chord by taking the root of the ii chord, "a" and go up a Perfect fifth to an "E", then build a Major triad on the E-now you have E,G#,& a B...now resolve it to an A minor chord and viola, you have artfully and gracefully changed where "do" is.
The rules are not really any different for making/resolving the vii*/ofs, the only difference is that instead of going up a perfect 5th to find the root of the secondary dominant, you go down a minor second. So again, in the context of G Major, if say you wanted to gracefully move to A minor, you could make a vii*/ii by taking the root of the ii chord-which is "A", go down a minor second to G#, then using G# as the root, build a diminished, 1/2 diminished 7th, or fully diminished 7th on the G#. Than resolve the chord to an A minor chord and presto...you are have tonicized a new key.