We call these triad qualities.
Whenever you determine the quality of a triad, you have to base it off of the root of the triad, not the tonic of the overall key.
So in C major, you have
D F A. Even though you're in C major (we call C the tonic of the key), we need to think briefly in the key of D to determine the quality of the
D F A triad.
In D major, there are two sharps: F# and C#. Since the
F in D major is actually
F♯ is the major third above D. As such, a D major triad would be
D F♯ A. Since we want
D F A, we see that the major third
F♯ is lowered a half step to the minor third
So we have
D F, which is a minor third. Now we need to look at the fifth
But there's a nice trick with fifths. If two pitches are a perfect fifth apart, they will share the same accidental. The only exception are the pairs B♭/F and B/F♯. Otherwise, all pitches that are a fifth apart and have the same accidental create a perfect fifth.
D A matches this rule, so it's a perfect fifth.
Now we have
D F A, which has a boundary interval of a perfect fifth and a third that is minor. This creates a minor triad.
If we turn now to
F A C, we think again in the key of the triad's root: here, F. F has one flat (B♭) in the key signature, otherwise everything else is natural in the F major key. Therefore, A is a major third above F, and we know from our previous rule that
F C is a perfect fifth. As such, a perfect fifth with a major third inside is a major triad.
There are two other triad qualities: diminished and augmented. Diminished triads have a diminished fifth (a perfect fifth that's one half step too small) with a minor third, and augmented triads have an augmented fifth (a perfect fifth that's one half step too large) with a major third.
- Major triad: major third with a perfect fifth; scale degrees 1 3 5 of a major scale.
- Minor triad: minor third with a perfect fifth; scale degrees 1 ♭3 5 of a major scale, or scale degrees 1 3 5 of a minor scale.
- Diminished triad: minor third with a diminished fifth; scale degrees 1 ♭3 ♭5 of a major scale.
- Augmented triad: major third with an augmented fifth; scale degrees 1 3 ♯5 of a major scale.
Lastly, the pattern of major and minor triads (with the last one being diminished) is what we call diatonic triads. This means that this is the pattern of chord qualities that obtains in any major key without any chromatic alterations.
As such, no matter what major key you're in, the chord built on the third scale degree of a major key will always be minor as long as there aren't any chromatic pitches added in. Similarly, the chord built on the fifth scale degree will always be major.
Note that this pattern of diatonic triads is different in a minor key. For this issue, see Understanding minor key harmony