There is confusion with the term diatonic. Most sources I've checked refer to the notes in major and minor scales. This is reflected within the key signatures. Thus any note from G major, including F# but not F, will be diatonic. So a tune which uses only those notes, in that key, at that point in the piece, will be diatonic. The minors have a bit of vagueness about them. The natural minor is fine, in that it contains the same notes as its relative major, reflected in the key sig. But both the harmonic and melodic contain notes not indicated in the key sig. However, most sources seem to be happy that they are also diatonic. As in a piece written in,say, A minor, can contain F, F#, G, G#, which may not be found in the key sig.
This means, according to some sources, that modes, as in Dorian, etc., can also be construed as diatonic.
The 'opposite' of diatonic is chromatic, where notes other than those specifically found within the key are used.