Major triads are built with a major third followed by a minor third from bottom to top. In a major scale, triads built on the 1st, 4th and 5th scale degrees are major. Major triads are often used in music that is intended to sound consonant, or free of dissonance. While all music contains a mixture of major and minor chords, in a major piece the emphasis is on major chords.
Minor triads are built with a minor third followed by a major third from bottom to top. In a major scale, triads built on the 2nd, 3rd and 6th scale degrees are minor. Pieces written in the minor often sound spooky, scary or sad to the listener. Bach's "Toccata and Fugue in D Minor" is in a minor key.
Diminished triads are constructed with two minor thirds. In a major scale, only the triad built on the 7th scale degree is diminished, so in the case of a C major scale, the B triad would be diminished. You cannot write a piece in a diminished key, as it is only a type of chord. Major and minor chords are the basis for western tonal harmony and they are also associated with scales and keys.
The augmented triad is built on two major thirds. This creates an unusual chord that is only found on the 3rd scale degree of the harmonic minor scale. Augmented chords rarely appear in classical music. Music is not written in an augmented key, as it is only a chord quality. A famous modern piece by Arnold Schoenberg, entitled, "Pierrot Lunaire" makes extensive use of augmented triads in the opening exposition of the composition.