In Classical music theory, chords are built and analyzed diatonically, or as to how each note that the chord is built on relates to a scale or key.
In Pic 1, here you see one of the most common chord progressions in pop/rock music, in the key of C identified by its name and by its function in the key, in this case, the key of C.
A major chord is built on the root, 3rd, and 5th tone of the major scale, and a minor chord is comprised ot the root flatted 3rd, and 5th of that scale. A dominant 7th adds a flatted 7th to the major chord.
Because a major scale consists of the following pattern (sometimes referred to as two tetrachords) ; whole step, whole step, half step, whole step, whole step, whole step, half step; a chord built on C will be considered the tonic or the I chord; the chord built on the F will be the subdominant or IV chord; the chord built on the G will be the dominant or V chord, etc.
Interestingly, since country music might generally be considered the polar opposite of classical music strictly in its relative harmonic simplicity compared to most genres, Nashville studio musicians teach each other songs by calling out I, IV, V7 chords, etc. because by identifying a chord in terms of its function in the key rather than the chord name, it allows them to learn to play the song in any key.
But what if you are writing songs that are more modal in nature and simply do not care about what function the chord plays in the key? Or what if you simply want to learn to build chords by picking them out on the piano or guitar to accompany a singer or instrumentalist?
If so, thinking of them chromatically rather than diatonically may be an easier and better approach.
Chromatic scales are built on half steps, e.g., C to C# to D to D#, etc.
So to put it in practical terms, if you press your thumb down on any note on a keyboard or guitar, count that note as '1', and then add another note counting up half steps until '5', and finally continuing up to '8' for the final note, you have a major chord. Period. No exception. No matter what the key and no matter where it falls in the song.
Similarly, a minor chord will be 1, 4, 8 and a dominant 7th will be 1, 5, 8, 11 while a minor 7th will be 1, 4, 8, 11.
In Pic 2, here you see the same chord progression labeled by its chromatic structure.
Here in Pic 3 are all the most common types of chords used in pop/rock music built and analyzed chromatically. Using this method, you can become quite fluent spelling chords out in your head without even having to be at your instrument.
I hope that you find this way of thinking chords helpful.