The harmonised major scale

Why some chords are major, some minor, and one diminished